I have 2 datasets in library aa & bb respectively. My code checks first the datasets in the library if they having specific column variables in them. If the datasets have the specific variables then they are appended. But when i run my macro it doesn't check the datasets in the library & appends their values in test1 & test2 as it should, it doesn't perform intended function of checking the dataset if they have the variables in them, and returns errors symbolic reference for &ds &list not found & also shows syntax error at &ds and &list.
can you'll suggest any edits...
below is my code..
%macro CHK(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;
%CHK(lib1=aa,lib2=bb,varlist=%str('nam', 'DD', 'ht'));