x cd /pub/data/acs/Tools; %let pgm=app_over55_bystate; filename pgm "&pgm..sas"; *--Pull pop over age 55 for a specified state from the latest 1-year estimates by race--; libname btabs '/pub/data/acs2013/basetbls'; *--It would be btabs5yr if we were accessing 5-year period ests--; proc format; value $arace A="White alone " B="Black or African American alone " C="American Indian & Alaska Native alone " D="Asian alone " E="Native Hawaiian & Other PI alone " F="Some Other Race alone " G="Two or more races " H="White alone, not Hispanic or latino " I="Hispanic or latino " ; run; data byrace; set btabs.ustabs00_07(keep=geocomp sumlev state areaname b01001: ); where state='29' and sumlev='040' and geocomp='00'; %macro dotabs; %let sfxs=ABCDEFGHI; %do i=1 %to 8; %let a=%substr(&sfxs,&i,1); %let t=b01001&a ; Race="&a"; Over55=sum(of &t.i13-&t.i16 &t.i28-&t.i31); format race $arace.; link output; %end; %mend dotabs; %dotabs; return; output: output; return; keep state areaname race Over55; run; title "Persons Over 55 by Race - 2-013 1-Year ACS Estimates"; proc print data=byrace; id state areaname; run;