x cd /pub/data/acs2009/Tools; %let pgm=pop_change_bytract; filename pgm "&pgm..sas"; *----Generate a file and report summarizing change in total pop by census tract between 2000 and the ACS 2005-2009 5-year period estimates. Note that these figures from the ACS data may be statistically questionable.---; libname acs2009 '/pub/data/acs2009'; %libname(sf32000x); libname user '/SAS_temp/user'; %let state=10; %let stab=de; *---just by changing these parms you should be able to run this for any state-----; %let statenm=Delaware; ods listing close; %*---macro statement goes here-----; %macro doit(state,stab); ods pdf file="/pub/data/acs2009/tractchangereports/&statenm..pdf" style=sasweb; /* ========================begin comment==================================== data tractpops2k; set sf32000x.ustracts(in=in2k keep=state esriid county tract totpop rename=(totpop=totpop2k)); where state="&state"; length geoid $28; geoid='14000US'||esriid; run; data acs2009.&stab.tract_poptrends(label="Population Trends at census tract level for &stab"); merge acs2009.usmcdcprofiles5yr(in=inacs keep=geoid sumlev state county totpop totpop_moe cbsa csa metrodiv where=(state="&state" and sumlev="140")) tractpops2k(in=in2k); by geoid; where state="&state"; if not (inacs and in2k) then do; if not in2k then nocensus+1; else noacs+1; put geoid= tract= inacs= in2k= totpop= totpop2k=; if mod(noacs,10)=1 and not inacs then put "***** " noacs=; if not inacs then delete; if not in2k and mod(nocensus,10)=1 then put "**** " nocensus=; if not in2k then tract=substr(geoid,13,4)||'.'||substr(geoid,17,2); end; PopChange=Totpop-totpop2k; if totpop2k then PctChange=100*PopChange/totpop2k; if totpop then Rel_MOE=totpop_MOE/totpop; format PopChange comma6. PctChange 5.1 Rel_MOE percent6.1; drop esriid nocensus noacs sumlev; label totpop='ACS 05-09/ Period Est' totpop2k='Tot Pop/2K Census' PopChange='Pop Change/Since 2K' PctChange='% Change' Rel_MOE='Rel. MOE for/ACS Estimate' totpop_moe='MOE for /ACS Est.' county='County' state='State'; run; ==========================end comment====================================== */ proc print label split="/" data=acs2009.&stab.tract_poptrends; **(drop= geoid cbsa csa metrodiv totpop_moe); by county; id county; var tract totpop totpop2k popchange pctchange totpop_moe rel_moe; sum totpop totpop2k PopChange; format county $county. rel_moe percent6.1; title "Estimated Changes in Population Since the 2000 Census for Census Tracts in &statenm."; footnote .h=1 "Report Produced by Missouri State Census Data Center Using Setup in"; footnote2 .h=1 " acs2009/Tools/&pgm..sas"; run; %mend doit; %dostates(10 29,names=1)