%macro list_files(dir,ext);
%local filrf rc did memcnt name i;
%let rc=%sysfunc(filename(filrf,&dir));
%let did=%sysfunc(dopen(&filrf));
%if &did eq 0 %then %do;
%put Directory &dir cannot be open or does not exist;
%return;
%end;
%do i = 1 %to %sysfunc(dnum(&did));
%let name=%qsysfunc(dread(&did,&i));
%if %qupcase(%qscan(&name,-1,.)) = %upcase(&ext) %then %do;
%put &dir\&name;
data _tmp;
length dir $512 name $100;
dir=symget("dir");
name=symget("name");
full_path = catx('\',dir,name);
run;
proc append base=want_new data=_tmp;
run;quit;
%end;
%else %if %qscan(&name,2,.) = %then %do;
%list_files(&dir\&name,&ext)
%end;
%end;
%let rc=%sysfunc(dclose(&did));
%let rc=%sysfunc(filename(filrf));
%mend list_files;
%list_files(\\path,sas)
I am trying to read all directory and its subdirectory for .SAS (SAS extension) files and then find specific string and create columns as file path and file name and string flag name for a specific string like datamart used in code and then create flag and assign value as 1 if its getting used within code and output as table.
... View more