x cd /mscdc/data/saipe/Tools; %let pgm=saipe97c.cnvt; filename pgm "&pgm..sas"; *--setup adapted from model used to convert the 95 file. The .sas module for that conversion was inadvertently written over but we used the .log file from the conversion to get the "starter" file with all the previous SAS code--; *----this setup converts the 1997 SAIPE poverty estimats for states and counties as released by the Bureau Nov. 2000---; *--These input files cames from the SAIPE ftp site at the Bureau. They were downloaded to the PC and then uploaded here.--; filename cntyin '/mscdc/data/saipe/est97_MO.dat'; filename cntyin '/mscdc/data/saipe/est97ALL.dat'; libname saipe '/mscdc/data/saipe'; title 'saipe97c.cnvt: Convert Income and Poverty Estimates Data for US ' 'States and Counties'; *options nocenter; options ls=157 ps=60; data saipes; retain year '1997'; *<--data for income year of 97 but based on 98 residents--; retain vers 'NOV00'; 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.us97(label='County pov and Med HH income ests 97' index=(state)); by state county; run; proc sql; *<--create views--; create view saipe.usstates as select * from us97(drop=cnty county) where slvl='010' or slvl='040'; *<--US totals or state totals-; create view saipe.mo97 as select * from us97 where state='29'; create view saipe.il97 as select * from us97 where state='17'; create view saipe.ks97 as select * from us97 where state='20'; create view saipe.stlmil97 as select * from us97 where slvl='050' and state in ('29','17') and put(county,$cntymet.)='7040M'; quit; proc contents data=saipe.us97 directory; title3 'Contents Report'; run; proc print data=saipe.us97(obs=25); title3 'Sample Report - First 25 Obs of saipe.us97'; title3 'Has US, State and County Summaries'; by year state stab; id cnty county areaname; run;