Delete specific sas datasets from a library
This post is part of 'SAS | Proc datasets' series
When writing complex programs or macros we frequently want to delete some specific intermediate datasets created.
Proc datasets can be used to achieve this.
proc datasets library=work memtype=data;
delete class2;
run;
quit;
- library= option is used to the name of the required library
- memtype=data is used on proc datasets statement to specify that only sas datasets are to be considered for deletion
- delete statement of proc datasets is used to specify the names of the datasets to be deleted from the library
- when multiple datasets are to be deleted, we can specify the list of datasets separated by space on delete statement
- we can even use shorthand notation of dataset naming convention on delete statement
- for example, if we want to delete all the datasets which begin with the text 'cl', we can use 'delete cl: ;'