Return to Archive

SAS Tip of the Month
July 2005

Datasets can be deleted using the DATASETS procedure, but there is another procedure which is just as good but is no longer supported by SAS Technical Support but is still available in SAS (thanks SAS for keeping your software backward compatible) - it is called PROC DELETE, and will only work on SAS datasets, not catalogs or views.

The syntax for this procedure is:

PROC DELETE DATA=<libname.>dataset-1 <libname.>dataset-n;

If LIBNAME is not given then it is assumed that the dataset is in the WORK directory. Note that a list of datasets can be given, each one separated by a space.

There also is one special way I like using it, and it is with the dataset name _ALL_ -- this removes all datasets within a directory. The following example shows its use:

   PROC DELETE work._ALL_;
Updated July 1, 2005