You do this in two steps. The first one reads the filenames into a dataset, while the second one uses that dataset to dynamically open the files and read them:
filename indata pipe 'dir /sas/sasconfig/Lev1/SASApp/WorkspaceServer/Logs /b';
data file_list;
length fname $128;
infile indata truncover; /* infile statement for file names */
input fname $128.; /* read the file names from the directory */
run;
data
x_wo_step (keep=fname text ds_name ds_count real_time)
w_step (keep=fname ds_name step_used)
x_step (keep=fname ds_name memory)
project_name (keep=fname ds_name proj_name)
;
set file_list;
do until (eof);
infile dummy filevar=fname truncover end=eof;
input text $1000. ;
if findw(text,"NOTE: The data set", ' ', 'E') eq 1 then do;
ds_name = scan(text,5," ");
ds_count = scan(text,7," ");
output x_wo_step;
end;
else if findw(text,"NOTE: Table", ' ', 'E') eq 1 then do;
ds_name = scan(text,3," ");
ds_count = scan(text,6," ");
output x_wo_step;
end;
end;
run;
Add code for what you want in w_step, x_step and project_name.
Note that your checks for findw were off (the NOTEs always appear in position 1) and the second arguments for the scan() function calls are different.
... View more