I tried with the below program.. but this can give only 1 search at a time... I had to write the macro Search n number of times to get an output in different datasets..and then append and then compare with the excel file.. if there is a way to find multiple strings from multiple sas files stored in one path that would help. %macro search(results,dataset,input); %let root= path; filename finp ("&root./&input..sas"); data &results.; length fname _filepath frname $200; infile finp filename = _filepath eov=_eov truncover; input a_line $200.; fname =compress(scan(_filepath,-1,'\'),".sas"); if _eov=1 then do; _n=0; _eov=0; end; _n+1; frname=compress(scan(a_line,-1,'.'),';'); if find(a_line,"&dataset.",'i') then output; keep _n fname frname; run; %mend search;
... View more