of the Month
Occasionally it is necessary to cleanup old datasets in a directory based on a date. The following SAS code is an example where datasets in the directory referenced by the LIBNAME OLDDATA that are older than 15MAR2007 are deleted:
%let dslist=%str(); proc sql; select memname into :dslist separated by ' ' from sashelp.vtable where libname='OLDDATA' and datepart(crdate) "15MAR2007"d; quit; run; proc datasets library="OLDDATA" nolist nodetails; delete &dslist quit; run;
This code can be modified to any datasets in a specified directory as well as and date and/or time that the user may choose.
Updated March 1, 2007