x cd /pub/data/saipe/Tools; %let pgm=saipe98c.cnvt; filename pgm "&pgm..sas"; *--setup adapted from model used to convert the 97 file.--; *----this setup converts the 1998 (income year - based on 1999 CPS data) SAIPE poverty estimates for states and counties as released by the Bureau Dec. 2001---; *--These input files cames from the SAIPE ftp site at the Bureau. They were downloaded to the .dat file being read by this setup 12-19-2001 (while data were still embargoed)--; ***filename cntyin '/pub/data/saipe/est98_MO.dat'; filename cntyin '/pub/data/saipe/est98ALL.dat'; libname saipe '/pub/data/saipe'; title 'saipe98c.cnvt: Convert Income and Poverty Estimates Data for US ' 'States and Counties'; *options nocenter; options ls=157 ps=60; data saipes; retain year '1998'; *<--data for income year of 98 but based on 99 residents--; retain vers 'DEC01'; label vers='Version (Census Bureau Relase Date)'; length default=5; attrib slvl length=$3 format=$slvl. label='Geographic summary level' state length=$2 label='State FIPS code' stab length=$2 label='State Postal Abbrev' county length=$5 format=$5. cnty length=$3 label='County FIPS code' areaname length=$40 poor label='Total Persons Below Poverty' poorstd2 label='Width of 90% conf interval for poor' povuniv label='Persons for who pov status assigned' format=comma9. pctpoor length=4 format=f5.1 label= "% Poor, All Persons" pp1std2 label='Width 90% conf intvl %Poor All Persons' poor5_17 label='# of Poor related Children 5-17' p517std2 label='Width of 90% conf intrvl- poor 5-17' povu5_17 label='Pov Universe for 5-17 rel children' format=comma8. pctp5_17 label='% Poor, Children 5-17' format=f5.1 pp3std2 label='Width 90% conf intvl %Poor 5-17' medhhinc label='Median Household Income' format=dollar8. mhhistd2 label='Width of 90% conf intrval - Medhhinc'; attrib poor0_17 label='Poor Persons 0-17' p017std2 label='Width of 90% conf intrvl-poor 0-17' pctp0_17 label='% Poor, Persons 0-17' pp2std2 label='Width 90% conf intvl %Poor 0-17' povu0_17 label='Pov Universe for 0-17 Persons' ; infile cntyin ; input state $char2. +1 cnty $char3. poor 8-15 conflim1 17-24 conflim2 26-33 pctpoor 35-38 conflima 40-43 conflimb 45-48 poor0_17 50-57 conflimc 59-66 conflimd 68-75 pctp0_17 77-80 conflime 82-85 conflimf 87-90 poor5_17 92-99 conflim3 101-108 conflim4 110-117 pctp5_17 119-122 conflimg 124-127 conflimh 129-132 medhhinc 134-139 conflim5 141-146 conflim6 148-153 stab $240-241 ; *--we do NOT READ the under-5 estimates, available only at the state level-; state=translate(state,'0',' '); cnty=translate(cnty,'0',' '); if cnty gt '000' then do; slvl='050'; county=state||cnty; areaname=put(county,$county.); end; else if state gt '00' then slvl='040'; else slvl='010'; *<--state and us-; if slvl='040' then areaname=put(state,$state.); else if slvl='010' then areaname='United States'; if pctpoor then povuniv=poor*100/pctpoor; if pctp5_17 then povu5_17=100*poor5_17/pctp5_17; if pctp0_17 then povu0_17=100*poor0_17/pctp0_17; poorstd2=(conflim2-conflim1)*.5; p517std2=(conflim4-conflim3)*.5; mhhistd2=(conflim6-conflim5)*.5; pp1std2=(conflimb-conflima)*.5; p017std2=(conflimd-conflimc)*.5; pp2std2=(conflimf-conflime)*.5; pp3std2=(conflimh-conflimg)*.5; drop conflim1-conflim6 conflima conflimb conflimc conflimd conflime conflimf conflimg conflimh; *--save vars with 2 standard deviation width values--; length poorstd2--pp3std2 4; run; proc sort out=saipe.us98(label='County pov and Med HH income ests for 98 income year' index=(state)); by state county; run; proc sql; *<--create views--; create view saipe.usstates as select * from us98(drop=cnty county) where slvl='010' or slvl='040'; *<--US totals or state totals-; create view saipe.mo98 as select * from us98 where state='29'; create view saipe.il98 as select * from us98 where state='17'; create view saipe.ks98 as select * from us98 where state='20'; create view saipe.stlmil98 as select * from us98 where slvl='050' and state in ('29','17') and put(county,$cntymet.)='7040M'; quit; proc contents data=saipe.us98 directory; title3 'Contents Report'; run; proc print data=saipe.us98(obs=25); title3 'Sample Report - First 25 Obs of saipe.us98'; title3 'Has US, State and County Summaries'; by year state stab; id cnty county areaname; run;