29 %macro mp_searchdata(lib=sashelp
33 ,outloc=%sysfunc(pathname(work))/mpsearch
36 %local table_list table table_num table colnum col start_tm vars type coltype;
37 %put process began at %sysfunc(datetime(),datetime19.);
40 %
if &
string = %then %let type=N;
44 libname mpsearch
"&outloc";
48 select distinct memname into: table_list separated by
' ' 49 from dictionary.tables where upcase(libname)=
"%upcase(&lib)";
52 %
if %length(&table_list)=0 %then %put library &lib contains no tables!;
54 %
else %
do table_num=1 %to %sysfunc(countw(&table_list,%str( )));
55 %let table=%scan(&table_list,&table_num,%str( ));
56 %let vars=%mf_getvarlist(&lib..&table);
57 %
if %length(&vars)=0 %then %
do;
58 %put NO COLUMNS IN &lib..&table! This will be skipped.;
62 create table mpsearch.&table as select * from &lib..&table
65 %
do colnum=1 %to %sysfunc(countw(&vars,%str( )));
66 %let col=%scan(&vars,&colnum,%str( ));
68 %let coltype=%mf_getvartype(&lib..&table,&col);
69 %
if &type=C and &coltype=C %then %
do;
73 %
else %
if &type=N and &coltype=N %then %
do;
79 %
if %mf_nobs(mpsearch.&table)=0 %then %
do;
80 drop table mpsearch.&table;
85 %put process finished at %sysfunc(datetime(),datetime19.);