x cd /pub/data/stf902/Tools; %let pgm=singleyrs_3cities; filename pgm "&pgm..sas"; *---Create a data set , CSV file with single years of age data by gender by race (white and black only) for 3 MO cities - Independence, KC and Joplin. the 1990 stf2, file b, Missouri, Table PB5: Sex(2) by Age(103). We keep all available chariters and geocomps. Coded by John Blodgett, OSEDA, Oct. 2001. ---*; title "Create stf902.&pgm : Detailed Age by Sex by Race by Hispanic origin for Missouri State and County"; libname user "/tmp/storage/john"; *<---special work-like directory--; libname stf902 '/pub/data/stf902'; filename dlmout "/pub/reports/temp/&pgm..csv"; /*<=========================Comment out===================================== signon oseda; *<--required to use the server= option to access data on another AIX box-; libname stf902b '/mscdc/data/stf902/b' server=oseda access=readonly; libname stf902a '/mscdc/data/stf902/a' server=oseda access=readonly; *++++Change of strategy after discovering that the place level summaries were MISSING from the stf902b.mobtbls dataset!!-; data user.&pgm (label='1990 STF2, File B, Table PB5 for selected places (no geocomps)'); length SumLev $3; ***set stf902b.mobtbls (keep=slvl placefp chariter areaname geocomp pb1i1 pb5i1-pb5i206); set stf902a.mobtbls (keep=slvl placefp chariter areaname geocomp county pb1i1 pb5i1-pb5i206); where slvl ='120' and geocomp='00' and chariter in ('000','001','002') and placefp in ('37592','38000','35000'); **SumLev='160'; label pb1i1='Total Pop 1990'; run; ===========================End commented out================================ */ proc sort data=user.&pgm; by placefp chariter; run; data togo; set user.&pgm; array pb5(2,103) pb5i1-pb5i206; length City $24 Race $5 Age 3 Male Female Total 5; if pb1i1=0 then do; put county= race= areaname= ' **deleted**'; delete; end; if chariter='000' then Race='Total'; else if chariter='001' then Race='White'; else if chariter='002' then Race='Black'; City=areaname; CumMale=0; CumFemale=0; CumTotal=0; do _iage=1 to 103; Age=_iage-1; Male=pb5(1,_iage); Female=pb5(2,_iage); Total=Male + Female; CumMale+Male; CumFemale+Female; CumTotal+ Total; output; end; keep placefp city county race age male female total CumMale CumFemale CumTotal; format county $5.; run; proc sort data=togo; by city county race age; run; %cnvtdlm(setin=togo,names=1); ods html file="/pub/reports/temp/&pgm..html"; options nodate; proc print data=togo; by city county race notsorted; format county $mocnty.; id age; var total male female CumTotal CumMale CumFemale; title '1990 Summary Tape File 2 Query: Single Yrs of Age by Race by Gender, Selected Missouri Cities / Counties'; footnote 'Report by the Missouri Census Data Center'; sum total male female; run;