x cd /pub/data/acspums/Tools; %let pgm=srhshlds_reports; filename pgm "&pgm..sas" ; *---emergency request from Bill Edler as followupo to application_srhshlds.sas setup. No time to talk about it. 6-11-07, jgb. ----; %let reptlib=%str(/pub/reports/temp/srhshlds); libname user '/SAS_temp/user'; libname acspums '/pub/data/acspums' access=readonly; libname corrlst '/pub/data/corrlst' access=readonly; libname temp '/pub/data/temp'; title .h=1 'Tabulations of Households by PUMA Regions, Missouri and the U.S. Based on 2005 ACS Data'; title2 'Extracted Estimates Based on Public Use Microdata Sample Datasets (a 1% sample)'; footnote h=1 "Run on &sysdate &systime"; options nodate; %macro dopct(num,den); %if &den=%str() %then %let den=TotHHs62; if &den then Pct&num=100*&num/&den; %mend dopct; proc format; value $superp 29100='North' 29200='Mid Missouri' 29300='KC suburban' 29400='KC city' 29500='West S Central/Lake Ozarks' 29600='St. Louis Metro West' 29701='Central & South St Louis County' 29702='St Louis city & North St L County' 29800='Southeast' 29900='Southwest'; Value $ten 1='Own w Mortgage' 2='Own no Mortgage' '3','4'='Rent'; Value ocpip 1-29='Less than 30' 30-high='30% or more'; Value yesno 1='Yes' 0='No '; run; /* =======================Begin comment================ data pumas; set corrlst.uspumas2k; where state='29'; rename puma5=puma; run; proc sort; by puma ; run; data mohhlds ushhlds ; merge acspums.ushrecs05(in=inh keep=st serialno puma wgtp type ten ocpip grpip hincp tel veh ybl where=(type='1' and ten ne ' ')) acspums.usprecs05(in=inp keep=st serialno agep ds pwgtp) end=last; by st serialno; drop pwgtp; length PUMA_Area $64; if puma ne lag(puma) then PUMA_Area=puma||' '||put(puma,$mopuma.); retain puma_area; if first.serialno then do; disabled_resident=0; ***Over65_HH= (agep >= 65); Over62_HH= (agep >=62); end; retain disabled_resident Over: ; if ds='1' then disabled_resident=1; if ds='1' then Disabled=1; else Disabled=0; if ten in ('3','4') then ocpip=grpip; *<----ocpip applies to owners and grpip to renters. But we are recoding so that the new ocpip applies to cost burden in either case----; label ocpip='Housing Cost Burden'; ocpipcat=ocpip; label ocpipcat='Housing Cost Burden category'; Nhhs=1; label Nhhs='# Households'; Persons=1; label Persons='Total Persons'; Over62= (agep >= 62); ***Over65=(agep >= 65); label Over62='Person Age 62+?'; *** Over65='Person Age 65+?'; TelInUnit=(tel='1'); VehAvailable = (veh gt 0); if ybl ne ' ' then OldHouse=(ybl in ('7','8','9')); *--i.e. if built before 1960--; label OldHouse='House built before 1960?'; format OldHouse yesno.; if hincp <= .6*41974 then Under_60Pct_MedInc=1; else Under_60Pct_MedInc=0; label Under_60Pct_MedInc='In HH w Income <= 60% State Median'; if last.serialno; output ushhlds; if st='29' then output mohhlds; ***output persons; format _numeric_ comma9.; label over62_HH='Household with head age 62+?' TelinUnit='Telephone in Unit?' disabled_resident='HH has disabled resident?' VehAvailable='Vehicle available in Unit?'; run; ======================End comment================== */ ods listing close; ods html file="&reptlib/&pgm..mo.html" style=sasweb; proc tabulate data=mohhlds format=comma9.; where over62_hh; freq wgtp; class puma_area Under_60Pct_MedInc ten; format Under_60Pct_MedInc yesno. ten $ten.; var nhhs ocpip telinunit VehAvailable hincp OldHouse ; ***title3 'Report 1: Poverty by When House Was Built'; table all='Missouri Totals' puma_area , (all='All 62+ Households' Under_60Pct_MedInc='Poor Household?') * (all='Total' OldHouse='Built < 1960'*(sum='Number' mean='Pct'*f=percent7.1)); table all='Missouri Totals' puma_area , (all='All 62+ Households' Under_60Pct_MedInc='Poor Household?') * (all='Total' VehAvailable='With Vehicle Available'*(sum='Number' mean='Pct'*f=percent7.1)); table all='Missouri Totals' puma_area , (all='All 62+ Households' Under_60Pct_MedInc='Poor Household?') * (all='Total' hincp='Household Income'*(median='Median'*f=dollar9.)); table all='Missouri Totals' puma_area, (all='All 62+ Households' Under_60Pct_MedInc='Poor Household?') * ten='Tenure'*ocpip=' '*(N*f=comma9. mean='Avg Cost Burden'*f=4.1); run; ods html close; ods html file="&reptlib/&pgm..us.html" style=sasweb; proc tabulate data=ushhlds format=comma9.; where over62_hh; freq wgtp; class puma_area Under_60Pct_MedInc ten; format Under_60Pct_MedInc yesno. ten $ten.; var nhhs ocpip telinunit VehAvailable hincp OldHouse ; ***title3 'Report 1: Poverty by When House Was Built'; table all='United States' , (all='All 62+ Households' Under_60Pct_MedInc='Poor Household?') * (all='Total' OldHouse='Built < 1960'*(sum='Number' mean='Pct'*f=percent7.1)); table all='United States' , (all='All 62+ Households' Under_60Pct_MedInc='Poor Household?') * (all='Total' VehAvailable='With Vehicle Available'*(sum='Number' mean='Pct'*f=percent7.1)); table all='United States' , (all='All 62+ Households' Under_60Pct_MedInc='Poor Household?') * (all='Total' hincp='Household Income'*(median='Median'*f=dollar9.)); table all='United States', (all='All 62+ Households' Under_60Pct_MedInc='Poor Household?') * ten='Tenure'*ocpip=' '*(N*f=comma9. mean='Avg Cost Burden'*f=4.1); run; ods html close;