filename dirtree url 'https://raw.githubusercontent.com/sasutils/macros/master/dirtree.sas';
%include dirtree;
%dirtree(directory=/home/fkhurshed/CLASS2, out=myfiles, maxdepth=1);
data erase;
set myfiles end = eof;
length str1 $1000.;
if _n_ =1 then call execute ('proc sql;');
if find( filename, 'sas7bdat')>0 then do;
datasetpath = catx('/', path, filename );
str1 = catx(' ', 'delete * from ', quote(trim(datasetpath)), ';');
call execute(str1);
end;
if eof then call execute ('quit;');
run;
Drop all rows from the datasets. %Dirtree will create the list of files - use maxdepth to control how far down the subdirectories you navigate.
... View more