Hello, This macro is a starting point. there are some notes in the log about the invalid argument of the INPUT function, but there will cause no harm. /*prepare some data*/ data a_20131212 a_20131213 a_20131214 a_20140112; set sashelp.class; run; %macro delt(lib, inpdate, daysbehinddel); %let refdate=%sysfunc(intnx(day,&inpdate, %eval((-1)*&daysbehinddel))); proc sql noprint; select memname into :deltables separated by " " from dictionary.tables where not(missing(input(scan(memname,2,"_"),yymmdd8.))) and input(scan(memname,2,"_"),yymmdd8.) lt %eval(&refdate) and upcase(libname)=upcase("&lib"); quit; %put &deltables; proc datasets library=&lib nolist; delete &deltables; quit; %mend delt; /*example of calling the macro*/ %delt(work,"01JAN2014"d,5)
... View more