26%macro mp_searchcols(libs=sashelp
32%put &sysmacroname process began at %sysfunc(datetime(),datetime19.);
37 select distinct upcase(libname) as libname
38 , upcase(memname) as memname
39 , upcase(name) as name
40 from dictionary.columns
41%
if %sysevalf(%superq(libs)=,
boolean)=0 %then %
do;
42 where upcase(libname) in (
"IMPOSSIBLE",
44 %
do x=1 %to %sysfunc(countw(&libs));
45 "%upcase(%scan(&libs,&x))"
55 length cols matchcols $32767;
56 cols=upcase(symget(
'cols'));
57 colcount=countw(cols);
58 by libname memname name;
60 putlog
"Searching libs: &libs";
61 putlog
"Searching cols: " cols;
63 if first.memname then
do;
68%
if &match=ANY %then %
do;
69 if findw(cols,name,,
'spit') then do;
71 matchcols=cats(matchcols)!!' '!!cats(name);
74%else %if &match=WILD %then %do;
82 curword=scan(cols,i,' ');
84 if index(name,cats(curword)) then do;
86 matchcols=cats(matchcols)!!' '!!cats(curword);
91 if last.memname then do;
92 if sumcols>0 then output;
93 if sumcols=colcount then putlog "Full Match: " libname memname;
95 keep libname memname sumcols matchcols;
98proc sort; by descending sumcols memname libname; run;
102%put &sysmacroname process finished at %sysfunc(datetime(),datetime19.);