Specifying Data Sets to Save
To delete all data sets but a few, you can use the SAVE statement to list the names of the
data sets that you want to keep. List the data set names with a blank space between the
names, or use an abbreviated member list (such as YRDATA1-YRDATA5) if applicable.
The following statements delete all the data sets except TEMPCHNG from the library
proc datasets library=usclim;
The following output shows the SAS log from the Save operation. SAS sends
messages to the log, verifying that it has kept the data sets that you specified in the
SAVE statement and deleted all other members of the library.
Log 39.10 Deleting All Members of the Library USCLIM except the Data Set TEMPCHNG
171 proc datasets library=usclim;
172 save tempchng;
NOTE: Saving USCLIM.TEMPCHNG (memtype=DATA).
NOTE: Deleting USCLIM.BASETEMP (memtype=CATALOG).
NOTE: Deleting USCLIM.HIGHTEMP (memtype=DATA).
NOTE: Deleting USCLIM.LOWTEMP (memtype=DATA).
NOTE: Deleting USCLIM.REPORT (memtype=CATALOG).
NOTE: Deleting USCLIM.USHIGH (memtype=DATA).
NOTE: Deleting USCLIM.USLOW (memtype=DATA).
Deleting All Files in a SAS Library
To delete all files in a SAS library at one time, use the KILL option in the PROC
The KILL option deletes all members of the library immediately after the
statement is submitted. You are not asked to verify the Delete operation, so make
sure that you intend to delete the files before submitting the program.
For example, the following program deletes all data sets in the library WEATHER and
stops the DATASETS procedure:
proc datasets library=weather kill;
Deleting All Files in a SAS Library 735