x cd /pub/data/acs2010/Tools; %let pgm=application_povertybybgs; filename pgm "&pgm..sas"; *---For city of Columbia, via tgr, pull povert data at BG level for Boone county.---; *---Adding PovCounty and PctPovCounty vars 9-4-12----------; libname acsbtabs '/pub/data/acs2010/basetbls'; libname temp '/pub/data/temp'; title "Alternate Measures of Income and Poverty for Boone County, Missouri"; Title2 "Source: American Community Survey (Census Bureau), 2006-2010 Period Estimates"; footnote .h=1 "Generated on &sysdate by John Blodgett, OSEDA, from setup in acs2010/Tools/&pgm..sas"; /* ========================begin comment==================================== ==========================end comment====================================== */ data temp.tempboonebgs(label="Boone co MO bgs from &pgm"); set acsbtabs.mobg5yr(keep=sumlev state county tract bg geoid b17010i: c17002i: b17017i: b17021i: b0000: b01001i1 b17017i: b19001i: b19013i: b19113i: b19202i: ); where state='29' and county='29019'; ** and sumlev='150'; run ; data temp.booneco_bgpoverty(label='2006-2010 poverty estimates for Boone county BGs'); set temp.tempboonebgs; length esriid $12 ; esriid=substr(geoid,8); TotPop=B01001i1; TotHHs=B19001i1; UnweightedPop=b00001i1; UnweightedHUs=b00002i1; MedianHHInc=B19013i1; PovUniverse=c17002i1; Poor=c17002i2+ c17002i3; if PovUniverse then PctPoor=100*Poor/PovUniverse; PoorHHs=b17017i2; if tothhs then PctPoorHHs=100*PoorHHs/TotHHs; FamHHs=b17010i1; NonFamHHs=TotHHs-FamHHs; PoorFamHHs=b17010i2; if FamHHs then PctPoorFamHHs=100*PoorFamHHs/FamHHs; PoorNonFamHHs= B17017i20; if NonFamHHs then PctPoorNonFamHHs=100*PoorNonFamHHs/NonFamHHs; *---New 7-5, we calculate HH poverty rates for head aged <25 and 25+ ----*; PoorYoungNonFamHHs=B17017i22 + b17017i27; YoungNonFamHHs=PoorYoungNonFamHHs + b17017i51 + b17017i56; if YoungNonFamHHs then PctPoorYoungNonFamHHs =100*PoorYoungNonFamHHs/YoungNonFamHHs; PoorOver25orFamHHs=PoorHHs - PoorYoungNonFamHHs; Over25orFamHHs=TotHHs- YoungNonFamHHs; if Over25orFamHHs then PctPoorOver25orFamHHs=100*PoorOver25orFamHHs/Over25orFamHHs; MedianFamInc=b19113i1; MedianNonFamInc=b19202i1; PersonsInFamilies=b17021i3 + b17021i20 - sum (of b17021i6 b17021i10 b17021i13 b17021i23 b17021i27 b17021i30); PoorPersonsInFamilies=b17021i3 - sum (of b17021i6 b17021i10 b17021i13); *--subtract non-relatives living in family hhs--; if PersonsInFamilies then PctPoorPersonsInFamilies=100*PoorPersonsInFamilies/PersonsInFamilies; Under185Pov=sum(of c17002i2--c17002i6); if PovUniverse then PctUnder185Pov=100*Under185Pov/PovUniverse; *---another attempot at mean poverty ratio used best available data--; if PovUniverse then MeanPovRatio=(c17002i2*.25 + c17002i3*.75 + c17002i4*1.125 + c17002i5*1.375 + c17002i6*1.675 + c17002i7*1.925 + c17002i8*3)/PovUniverse; *---the median HH income of Mo is $46,262 and for Boone co is $45,786. We use the larger value (state) to come up with the DED, statute-based definition of "poor households", those that have HH income below 90% of the state median. 90% of 46,262 is 41,636. This leads us to do linear interpolation of the 9th cell of table b19001 which is the $40,000 to $44,999 hh income inverval---; PovCounty=round( sum(of b19001i2-b19001i8) + (1636/5000)*b19001i9); if TotHHs then PctPovCounty=100*PovCounty/TotHHs; label PovCounty="Poverty HHs (DED)" PctPovCounty="% Pov HHs (DED)"; keep povcounty pctpovcounty; keep esriid county tract bg TotPop--MeanPovRatio; label UnweightedPop="Unweighted Sample Pop" UnweightedHUs="Unweighted Sample HUs"; label personsinfamilies="Persons in Families" PoorPersonsInFamilies="Poor in Families" PctPoorPersonsinFamilies="% Poor: Persons in Families" Under185pov="Pov Ratio < 1.85" PctUnder185pov="% Pov Ratio < 1.85"; label MedianHHInc="Meidan HH Income" MedianFamInc="Median Family Income" MedianNonFamInc="Median Non-family HH Income"; label PoorNonFamHHs='Poor Non-Fam HHs' PctPoorNonFamHHs='% Poor Non-Family HHs'; label PctPoorFamHHs='% Poor Families'; label poor='Poor Persons' pctpoor='% Poor'; label PoorYoungNonFamHHs='Poor Young Non-family Hshlds' PctPoorYoungNonFamHHs='% Poor Young Non-fam Hhlds'; label PoorOver25orFamHHs='Poor Head Aged 25+ or Family Hshlds' PctPoorOver25orFamHHs='% Poor Aged 25+ or Family Hhlds'; label PoorHHs='Poor Hshlds' PctPoorHHs='% Poor Hshlds'; format pct: 5.1; format MeanPovRatio 5.3; label MeanPovRatio="Mean Poverty Ratio (est)"; run; *---Aggregate to census tract so we can compare tract-level data here vs what was published at tract level---; %agg(aggin=temp.booneco_bgpoverty,aggout=aggout, aggby=county tract, aggvars=_numeric_, means=PctPoor PctPoorFamHHs PctPoorNonFamHHs PctUnder185Pov PctPoorPersonsInFamilies MeanPovRatio PctPoorHHs PctPoorYoungNonFamHHs PctPoorOver25orFamHHs PctPovCounty, meanwts=PovUniverse FamHHs NonFamHHs PovUniverse PersonsInFamilies PovUniverse TotHHs YoungNonFamHHs Over25orFamHHs TotHHs, agglvl=2, debug=0); run; data temp.booneco_tractpoverty(label="2006-2010 poverty estimates for Boone county Tracts"); length Areaname $32; set aggout; if _lvl_=1 then areaname='Census Tract ' || tract; else areaname='Boone County totals'; if _lvl_=1 then SumLev='140'; else SumLev='050'; drop _lvl_; label _nag_='# BGs'; rename _nag_=NBGs; run; proc sort; by sumlev; run; ods html file="&pgm..html" style=analysis; %let rvars=TotPop TotHHs PoorHHs PctPoorHHs FamHHs PctPoorFamHHs NonFamHHs PctPoorNonFamHHs PoorYoungNonFamHHs PctPoorYoungNonFamHHs PctPoorOver25orFamHHs PctPoor PctPoorPersonsInFamilies PovCounty PctPovCounty; proc print label data=temp.booneco_bgpoverty; *** (obs=250 drop=county esriid povuniverse); by tract; id tract; var BG &rvars; title3 "Report 1: Data at the Block Group Level"; run; proc print label data=temp.booneco_tractpoverty; title3 "Report 2: Data at the Census Tract and County Levels (aggregated from BG data)"; by county ; id areaname ; var &rvars; run; ods html close;