Hi All, Thank you for your responses. I should have been more clearer in my original post. Basically, I am reading names of all the sas programs from a given directory and then I am trying to put them in a text file. - First read all program names - Put all these program names in a text file Here is the full code filename mybatch "/space/kstr395/brim/misc/programs/batch.txt"; %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; data _null_ ; file "/space/kstr395/brim/misc/programs/batch.txt" recfm=N dlm=' ' lrecl=500000; %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 @@; put &name @@ ; %end; %else %if %qscan(&name,2,.) = %then %do; %list_files(&dir/&name,&ext) %end; %end; run; %let rc=%sysfunc(dclose(&did)); %let rc=%sysfunc(filename(filrf)); %mend list_files; %list_files( %str(/space/kstr395/brim/misc/programs),sas) ; I am getting an error "Data Step Component Object Failure. Aborted during compilation phase"
... View more