my code checks the datasets in a library if they have the required variables then append them.
below is my code ---->
%macro chkvar(lib1=,lib2=,varlist=);
%local list ds ;
proc sql noprint; select distinct catx(".",libname,memname) into :list separated by " " from dictionary.columns where libname = %upcase ("&lib1") and %upcase(name) in("&varlist") ; quit; %put &list;
data test1; set &list; run;
proc sql noprint; select distinct catx(".",libname,memname) into :ds separated by " " from dictionary.columns where libname = %upcase ("&lib2") and %upcase(name) in("&varlist") ; quit;
%put &ds;
data test2; set &ds; run;
%mend CHK;
%chkvar(lib1=detail,lib2=stats,varlist=%str('nam', 'DD', 'ht'));
but some how the code returns error of symbolic refrence to &list and &ds not found and also doedn't check the given library at all for the data-sets which hav the variables. ihave created 2 separate librarys 'detail' and 'stats' with the variables still it doesn't do the intented task.. can u suggest in any edit to rectify my code...
... View more