x cd /pub/data/acspums/Tools; %let pgm=application_apportionpovratio; filename pgm "&pgm..sas" ; *---the client wanted to get data for persons under 130% of poverty. The ACS table we had used an interval of 1.25-1.999 . So what we are doing here is determining what portion of persons in this larger interval are in the 1.25-1.29 subinterval. They can then apply this ratio to get an estimate for the interval they are interested in. 2-10, jgb 3-10: run again but now with children defined as 0-4 and the sub-interval is 1.25 - 1.8 1-12: running again with 2009 & 2010 1 year data also being used. 12-15: running agains with latest 5 years of data thru 2014. 07-16: running again to get apportioning factor for the 125-134 subinterval. ----; libname acspums '/pub/data/acspums'; /* ========================begin comment==================================== code as run in 2010================= data _null_; set acspums.moprecs083yr(keep=serialno pwgtp povpip agep) end=last; where 125 <= povpip <=199; Universe + pwgtp; if povpip <= 179 then InSubInterval + pwgtp; if agep < 5 then do; UniverseKids + pwgtp; if povpip <= 179 then InSubIntervalKids + pwgtp; end; format _numeric_ comma11.; cklast: if last then do; Pct_all=100*inSubInterval/Universe; Pct_kids=100*InSubIntervalKids/UniverseKids; put Universe= InSubInterval= Pct_all 5.1; put UniverseKids= SubIntervalKids= Pct_kids 5.1; end; run; ==========================end comment====================================== */ %let keepvars=pwgtp povpip agep; title "&pgm : For Kids < 18 and Elders >= 65"; title2 "Universe is Persons With Poverty Ratio in 1.25 to 1.5"; data _null_; ***---do the 125-129 subsinterval of 125-149 for <18 and > 65 and all---; ***set acspums.moprecs06(keep=&keepvars ) acspums.moprecs07(keep=&keepvars ) acspums.moprecs08(keep=&keepvars ) acspums.moprecs09(keep=&keepvars ) acspums.moprecs10(keep=&keepvars ) end=last; set acspums.moprecs10(keep=&keepvars ) acspums.moprecs11(keep=&keepvars ) acspums.moprecs12(keep=&keepvars ) acspums.moprecs13(keep=&keepvars ) acspums.moprecs14(keep=&keepvars ) end=last; retain PovertyInterval '125 to 149%' ; *retain SubInterval '125 - 129 %'; retain SubInterval '125 - 134 %'; where 125 <= povpip <=149; pwgtp=pwgtp* .2; *---divide weight by 5 because we are using 5 years of data---; Universe + pwgtp; *if povpip <= 129 then InSubInterval + pwgtp; if povpip <= 134 then InSubInterval + pwgtp; if agep < 5 then do; UniverseKids + pwgtp; if povpip <= 134 then InSubIntervalKids + pwgtp; end; if agep >= 65 then do; UniverseElder + pwgtp; if povpip <= 134 then InSubIntervalElder + pwgtp; end; format _numeric_ comma11.; cklast: if last then do; format Universe: inSub: comma9.; put '*** ' PovertyInterval= SubInterval= +1 '***' /; Pct_all=100*inSubInterval/Universe; Pct_kids=100*InSubIntervalKids/UniverseKids; Pct_elder=100*InSubIntervalElder/UniverseElder; put Universe= InSubInterval= Pct_all 5.1; put UniverseKids= InSubIntervalKids= Pct_kids 5.1; put UniverseElder= InSubIntervalElder= Pct_elder 5.1; end; run;