x cd /pub/data/acs2006/Tools; %let pgm=placepop_moes; filename pgm "&pgm..sas"; *-----Look at the MOEs for total pop estimates on the acs profiles and see how the estimate/moe compares with the official estimate on the ussc06 dataset. jgb, 10/07 ----; %libname(acs2006); libname popests '/pub/data/popests' access=readonly; libname user '/SAS_temp/user'; title 'Examination of acs2006 Total Pops for Places vs FSCPE Estimates of those Places'; title2 "Relating differences between the ACS estimate and the FSCPE figure wrt the MOE for the ACS Estimate"; footnote "Missouri Census Data Center, from setup in acs2006/Tools/&pgm..sas"; proc format; value yesno 1='Yes' 0='No '; run; data popests; set popests.ussc06(keep=sumlev state placefp popest areaname); length geoid $20; where sumlev='162' and popest ge 60000; geoid='16000US'||state||placefp; drop sumlev; rename areaname=areanameCK; run; proc sort; by geoid; run; data acspops; set acs2006.usmcdcprofiles(keep=geoid areaname sumlev TotHHs TotHHs_MOE TotPop TotPop_MOE); where sumlev='160'; if _N_ le 10 then put _all_; run; proc sort; by geoid; run; data placepop_diffs; merge popests(in=inests) acspops(in=inacs); by geoid; if not inacs then do; if popest ge 65000 then put "***No ACS data found for this place: " state= placefp= areanameCK=; delete; end; if not inests then do; if index(areaname,'CDP')=0 then put '***No estimate found for this place: ' geoid= areaname=; delete; end; if totpop_moe=. then delete; *<---independent cities need to be excluded----; Estdiff=TotPop - popest; AbsDiff=abs(estdiff); PctDiff=100*AbsDiff/popest; format PctDiff 5.1; InConfidence= (AbsDiff le TotPop_MOE); DiffInMOEs= AbsDiff/TotPop_MOE; format DiffInMOEs 6.2; if popest lt 100000 then SizeCat=65; else if popest lt 250000 then SizeCat=100; else if popest lt 500000 then SizeCat=250; else if popest lt 1000000 then SizeCat=500; else SizeCat=1000; if not (trim(areanameCK)=:Areaname) then put "***Areaname discrepancy: " areanameCK= areaname= geoid=; drop areanameck placefp sumlev; label estdiff='ACS Total Pop Est - FSCPE Estimate' AbsDiff='Abs Value of estdiff' PctDiff='AbsDiff as % of Popest'; label totpop_moe='Total Pop/ACS MOE' totpop='Total Pop/ACS 2006' popest='FSCPE 2006/Pop Est' InConfidence='FSCPE Est/In ACS/Conf Intrvl?' Diffinmoes='Estimate/Difference/in MOEs' areaname='City'; format InConfidence yesno.; run; ods html file="&pgm..html"; * options nodate; proc print data=placepop_diffs label split='/'; where popest ge 250000; id areaname; var totpop totpop_MOE Popest Estdiff Pctdiff InConfidence DiffInMOEs; title3 "Population Difference Data for Places of 250,000 or More"; run; proc freq data=placepop_diffs; title3 "Simple Frequencies on the InConfidence Flag Variable"; table inconfidence SizeCat*InConfidence; run; proc tabulate data=placepop_diffs; title3 "Tabular Report Summarizing the 3 Measures of Difference Between the 2 Estimates"; class inconfidence sizecat; var AbsDiff PctDiff DiffInMOEs; table all sizecat,AbsDiff*mean*f=comma12. PctDiff*mean*f=12.1 DiffInMOEs*mean*f=11.2; run; ods html close; **ods html file="/pub/reports/placepop_moes_detail.html" ;