x cd /pub/data/acspums/Tools; %let pgm=application_custom_povrates; filename pgm "&pgm..sas" ; *---the request from floor of the Missouri State Legislature: What number and percent of people are below the poverty line from these categoreis: -Single parent households. -Persons aged 16-22 (inclusive on both ends) -Persons without a high school diploma or GED [we shall restrict this to persons aged 20+] -Persons working part time. 1-9-07, jgb. ----; libname acspums '/pub/data/acspums'; *-----------Step 1: Get the # and pct of single-parent Households who are poor--; data _null_; *--FES indicates categories of parents in workforce and includes 4 cases of single-parent which we choose. FPARC indicates combinations of own children present by age cohorts. We take all cats that indicate kids. And we make sure that poverty status is assigned.---; merge acspums.mohrecs05(in=inh keep=serialno wgtp type FES FPARC where=( FES in ('5','6','7','8') and FPARC in ('1','2','3')) ) acspums.moprecs05(in=inp keep=serialno povpip rel where=(rel='00')) end=last; by serialno; if inh and inp and first.serialno and povpip ne . then do; TotHHLDs + wgtp; if povpip le 100 then PoorHHLDs + wgtp; end; format _numeric_ comma9.; if last then do; PctPoorSingleParentHouseholds=100*PoorHHLDs/TotHHLDS; format PctPoor: 5.1; put PctPoorSingleParentHouseholds= TotHHLDs= PoorHHLDs=; end; run; *--The answer was 36.0% of single-parent households were in poverty in 2005 in Missouri---; *---Step 2: In one pass we keep counts of poor universes and counts of poor persons in 3 categories---; data _null_; set acspums.moprecs05(keep=pwgtp agep schl povpip wkhp) end=last; where povpip ne .; _poor= (povpip le 100); if agep ge 20 and SCHL le '08' then do; Over20NoHS +pwgtp; If _poor then PoorNoHS + pwgtp; end; if (16 <=agep <=22) then do; Age16to22 + pwgtp; if _poor then PoorAge16to22 + pwgtp; end; if agep >= 16 and (1 <= wkhp < 30) then do; *--age 16+ with usual hrs worked last 12 months between 1 and 29 (part-time worker)-; PartTime + pwgtp; if _poor then PoorParttime + pwgtp; end; if last then do; PctPoorNoHS=100*PoorNOHS/Over20NoHS; PctPoor16to22=100*PoorAge16to22/Age16to22; PctPoorPartTime=100*PoorPartTime/PartTime; format Porr: comma9. Pct: 5.1; put PctPoorNoHS= PoorNOHS= / PctPoor16to22= PoorAge16to22= / PctPoorPartTime= PoorPartTime=; put '***Note: Poverty rate and counts for "No High School" is only for persons aged 20 or over'; end; run;