Hello, The following macro may serve your needs: /*prepare some data*/ data have1; set sashelp.class; a+1; run; data have2; set sashelp.class; b='rete'; run; data have3; set sashelp.class; a+1; b='rete'; run; %macro test (dbase, vars=a b, library=WORK); %let i=1; %Do %until(%scan(&vars,%eval(&i))=) ; %let J=1; %Do %until(%scan(&dbase,%eval(&j))=) ; %let varname=;%* clear the variable; proc sql; select name into :varname from sashelp.vcolumn where libname="&library" and name=" %scan(&vars,%eval(&i))" and memname="%scan(&dbase,%eval(&j))"; quit; %if &varname=a %then %do; data %scan(&dbase,%eval(&j)); set %scan(&dbase,%eval(&j)); a=a*2; run; %end; %if &varname=b %then %do; data %scan(&dbase,%eval(&j)); set %scan(&dbase,%eval(&j)); b=compress(b); run; %end; %let j=%eval(&j + 1); %end; %let i=%eval(&i + 1); %end; %mend test; /*call the dbases with capital letters*/ %test (HAVE1 HAVE2 HAVE3)
... View more