Thanks all for your help. data all_data; set TEMP.TABLE_PGM_CONTENTS_COMMENTS; run; proc sort data=all_data; by pgm_sas line_nr; run; proc sql; create table allLibnames as select distinct libname from sashelp.vlibnam where libname ne "WORK"; run; data allLibnames; set allLibnames; lengthlib = length(libname); run; proc sort data=allLibnames; by lengthlib; run; proc sql; select strip(libname) into:all_libs SEPARATED BY "#" from alllibnames; quit; %macro loopLibname; %let count = 1; data Result; format library $8.; set all_data; %let lib=%scan(&all_libs,&count,%STR(#)); %do %while (&lib ne); if index(upcase(pgm_line) , "&lib") and index(upcase(pgm_line) , "*") and not index(upcase(pgm_line) , "/*") and not index(upcase(pgm_line) , "(*)") and not index(upcase(pgm_line) , "JOB") and not index(upcase(pgm_line) , "SCD2") and not index(upcase(pgm_line) , "/") then library = "&lib"; %let count=%eval(&count+1); %let lib=%scan(&all_libs,&count,%STR(#)); %end; if library ne ""; run; %mend; %looplibname; proc sort data=result nodupkey; by pgm_sas library; run; data TEMP.LIBRARIES_PER_JOB; set result(keep=pgm_sas library); run;
... View more