Return to Archive

SAS Tip of the Month
April 2003

Do you want to delete a dataset from a particular library, or possibly all datasets in a library? One way to do it is with the use of the DATASETS procedure, as shown in the following examples:

   *** Delete the single dataset CLASS in the library WORK;
   proc datasets library=work nolist nodetails nowarn;
      delete class /mt=data; *** Delete a single dataset;
      quit;
   run;
   *** Delete all the datasets in the library WORK;
   proc datasets library=work nolist nodetails nowarn kill mt=data;
      quit;
   run;

Note that in the first example, the DELETE statement will only work on datasets in the library specified by the LIBRARY option in the top line of the procedure call. The KILL option on the first line of the second example deletes all members of the library WORK, restricted to datasets by using the MT= option in the first line of the procedure call.

________________________________
Updated April 1, 2003