x cd /pub/data/acs2011/Tools; %let pgm=gen_acsvarlist; filename pgm "&pgm..sas"; *---access the variables metadata set 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. Rerunning from acs2011/Tools 6-13 with additional code to generate the meansbg and mwgtsbg vars. (Earlier run was done from acs2010/Tools). Starting with the 2012 cycle we shall move this setup to the acs/Tools directory and reuse it each year/cycle. ---; %libname (acs2011); /* ========================begin comment==================================== 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_; ==========================end comment====================================== */ data variables5bg; set acs2011.variables5yr(keep=variable_name percent_variable wtvar univvar); retain acs5yrvars "%varlist(_numeric_,acs2011.usbgs5yrtemp)"; NoPercentVar= (univvar in ('CivLabForce','HHPop')); 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 :pctvarsbg separated by " " from variables5bg where (percent_variable ne ' ' and NoPercentVar=0) ; select univvar into :pctwtsbg separated by " " from variables5bg where (percent_variable ne ' ' and NoPercentVar=0) ; select variable_name into :meansbg separated by " " from variables5bg where wtvar ne ' '; select wtvar into :mwgtsbg separated by " " from variables5bg where wtvar ne ' '; data _null_; *---this will trigger errors when we have variables not on data set-; set acs2011.usbgs5yrtemp(keep= &pctvarsbg &meansbg &pctwtsbg &mwgtsbg); stop;run; %put _global_;