Delete all sas datasets from a library
This post is part of 'SAS | Proc datasets' series
Below are a few scenarios where we want all the sas datasets from a specific library to be deleted.
- At the start of a sas program such that the previously created datasets do not impact the current run of the program
- When writing complex programs which create lot of intermediate datasets which need not be stored
- When executing a macro which creates a lot of intermediate temporary datasets multiple times with in a SAS session
Proc datasets of SAS can be used to specifically delete ONLY the datasets from a library.
proc datasets library=work memtype=data kill;
- library= option is used to the name of the required library
- kill option on proc datasets is used to delete the sas files
- By default, kill option deletes sas datasets, views, format catalogues
- The key here is to specify the option memtype=data on the proc datasets to explicity specify that only datasets have to be deleted