x cd /pub/data/acs2010/Tools; %let pgm=gen_acsvarlist; filename pgm "&pgm..sas"; *---access the variables metadata sete to generate macro variables acsmeans and acsmwts which can be use to aggregate the 5yr data sets. Had to rerun with new acs2010.variables5yr set 3-16-12. ---; %libname (acs2010); data variables5; set acs2010.variables5yr(keep=variable_name percent_variable wtvar univvar); retain acs5yrvars "%varlist(_numeric_,acs2010.ustracts5yr)"; if _n_=1 then acs5yrvars=upcase(acs5yrvars); if index(acs5yrvars,trim(upcase(variable_name))) then output; else put variable_name= ' --deleted ***'; run; proc sql noprint; select percent_variable into :pctvars separated by " " from variables5 where percent_variable ne ' '; select univvar into :pctwts separated by " " from variables5 where percent_variable ne ' ';; select variable_name into :means separated by " " from variables5 where wtvar ne ' '; select wtvar into :mwgts separated by " " from variables5 where wtvar ne ' '; data _null_; set acs2010.ustracts5yr(keep= &pctvars &means); *---this will trigger errors when we have variables not on data set-; stop;run; %put _global_;