Here is a solution for you. The variable types should be same in all data sets.
%let var=DENSITY;
%let lib=MAPS;
proc sql noprint;
select catt(libname,'.', memname, '(keep=DENSITY)' )
into: dsnlist separated by ' '
from dictionary.columns
where libname="&lib" and name="&var";
;
quit;
data _null_;
if &sqlobs>0 then do;
call execute("data need; set &dsnlist; run;");
end;
else put "there is no variable &var found in library &lib";
run;


雷达卡





京公网安备 11010802022788号







