x cd /pub/data/acspums/Tools; %let pgm=application_povrates_bycollege; filename pgm "&pgm..sas" ; *---the request from local Columbia Missourian reporter: We understand that the poverty figures for Columbia (Boone County) are skewed by counting many of the local students as poor when they have family financial support that is not considered. Could we look at the poverty rates for students vs non-students? We use the latest (2005) ACS pums data to respond to this request. We can do it for Boone county because it happens to correlate directly with a PUMA area. Rerunning 6-08 to combine 2 years of acspums data (05 and 06). ----; libname acspums '/pub/data/acspums' access=readonly; data xtract; set acspums.moprecs05(in=inp keep=serialno puma povpip sch schg pwgtp) acspums.moprecs06(in=inp keep=serialno puma povpip sch schg pwgtp in=in06) end=last; *---we have nothing form the housing records dataset that we need for this application.---; where povpip ne . ; *<------------------Data filters: Must be in the poverty universe--; *--create a new category variable that tells us if this is a student or not---; if schg in ('6','7') then InCollege='Yes'; else InCollege='No '; *--excerpt from the data dictionary pdf file: SCHG 1 098 Grade level attending b .N/A (not attending school) 1 .Nursery school/preschool 2 .Kindergarten 3 .Grade 1 to grade 4 4 Grade 5 to grade 8 5 .Grade 9 to grade 12 6 .College undergraduate 7 .Graduate or professional school -----*; *--the povpip variable contains the poverty index. A value of 100 means the person is at the poverty line while a value of 90 means their income is 90% of the poverty threshold. We classify someone as poor if this number is <= 100 --; if povpip<=100 then Poor='Yes'; else Poor='No '; PoorNumeric=(povpip <=100); *--assigns the result of the logical expression to variable so that it has a value of 1 if the person is poor and a value of 0 otherwise. We will have SAS take an average of these 1 and 0 values as an easy shortcut to calculating poverty rates; if in06 then year='2006'; else year='2005'; Area='Missouri'; output; *<---all of the state--; if puma='00600' then do; Area='Boone Co.'; output; *<---output Boone county observations twice, once as part of the state, and once as Boone--; end; keep Area InCollege Poor povpip pwgtp PoorNumeric Year; *---all we keep are the 2 newly created categories along with the poverty the case (person) weight. And the numeric (0/1) variable for poor.----; run; ods html file="&pgm..html" style=minimal; *<---causes output tables to be written to this html file in current (Tools) dir.--; title 'Poverty in Missouri and Boone County, MO by College Enrollment Status'; title2 ' Estimated from 2005 and 2006 ACS PUMS Data'; title3 "Universe is Persons for Whom Poverty Status Was Assigned (Omits Persons in Dormitories)"; title4 'Part 1: Using Person Weights'; footnote "Produced From Setup in /pub/data/acspums/Tools/&pgm..sas"; *---summarize the results with the SAS tabulate procedure---; proc tabulate data=xtract; class InCollege Poor Area Year; var povpip PoorNumeric; label InCollege="Enrolled in College?" PoorNumeric="Poor"; freq pwgtp; *--we could do this first table just as easily with Proc Freq, of course. --; table all='Both Years combined' year, All='Total' InCollege, Area*(all Poor)*N*f=comma9.; *--this table calculates poverty rates and average poverty ratios----; table all='Both Years combined' year,all='Total' InCollege, Area*PoorNumeric='Poor'*(n*f=comma11. mean='Pct'*f=percent6.1) povpip=' '*mean='Mean Poverty Ratio'*f=9.1; run; proc tabulate data=xtract; class InCollege Poor Area Year; var povpip PoorNumeric; label InCollege="Enrolled in College?" PoorNumeric="Poor"; ***freq pwgtp; *<====here we comment out the freq statement to make these numbers unweighted---; title4 "Part 2 (for stat heads only): Unweighted Numbers"; *--we could do this first table just as easily with Proc Freq, of course. --; table all='Both Years combined' year,All='Total' InCollege, Area*(all Poor)*N*f=comma9.; *--this table calculates poverty rates and average poverty ratios----; table all='Both Years combined' year,all='Total' InCollege, Area*PoorNumeric='Poor'*(n*f=comma11. mean='Pct'*f=percent6.1) povpip=' '*mean='Mean Poverty Ratio'*f=9.1; run; *--note that without the run statement the output from this tabulate step would not be written to the html file--; ods html close;