x cd /pub/data/pl942000/Tools; %let pgm=hierlist; filename pgm "&pgm..sas"; /*--Generate the hierarchal listing reports for the Mo State Library. Modeled after reports done in last 2 decades. John Blodgett, OSEDA, U. of Missouri Outreach & Extension -- */ title 'Missouri Census Data Center Report'; title2 '2000 PL94-171 Unadjusted Data File - Hierarchal Geography Extract'; footnote '1. Blocks With 0 Persons are Not Listed'; footnote2 '2. Blacks Over 18 Includes Partly Black'; footnote3 'Report Generated by OSEDA Under a Contract With the Missouri Census Data Center'; options ls=132 ps=60 nodate; %libname (pl942000); libname user '/SAS_temp/user'; %let htmldir=%str(/pub/reports/pl94hier); options formdlim='='; proc format; value $gu '050'='CO' '700'='VT' '710'='MC' '720'='PL' '730'='TR' '740'='BG' '750'='BL'; run; %macro docnty(county,cntyname,reptonly=0); title3 "&cntyname, Missouri"; %if &reptonly=0 %then %do; data insums/view=insums; set pl942000.mosums; where county="&county"; run; *-------------Step 1: Create the 3 Discarded summary levels - 710, 720 and 730 by aggregating the split-bg (740) level data.----------*; proc means data=insums(where=(sumlev='740')) noprint; by county; var totpop--BlOvr182 multrace; class vtd cousubfp placefp tract; id state; types ( ) vtd*cousubfp vtd*cousubfp*placefp vtd*cousubfp*placefp*tract; output out=sumsout sum=; run; data sumsout2; *--post edit and add geo ids--; length areaname $40 sumlev $3 geocode $32; set sumsout; select (_type_); when (0) delete; *--county sums created just as a check--; when (12) do; sumlev='710'; geocode=%concatd(county,vtd,cousubfp); areaname=put(cousubfp,$momcd.); end; when (14) do; sumlev='720'; geocode=%concatd(county,vtd,cousubfp,placefp); if placefp ne '99999' then areaname=put(placefp,$mofplac.); else areaname='Unincorporated'; end; when (15) do; sumlev='730'; geocode=%concatd(county,vtd,cousubfp,placefp,tract) ; length edtract $7; edtract=tranwrd(tract,'.00',' '); drop edtract; _i=1; do while(substr(edtract,_i,1)='0'); substr(edtract,_i,1)=' '; _i+1; end; areaname='Tract '||left(edtract); end; end; if substr(county,3,3)='510' and sumlev in ('710','720') then delete; *--filter mcd and place summaries for city--; drop _type_ _freq_; return; run; proc sort data=insums out=insums2; by vtd cousubfp placefp tract bg block; run; proc sort data=sumsout2; by vtd cousubfp placefp tract ; run; data rpt&county; set sumsout2 insums2 (where=(sumlev =:'7' or sumlev='050')); by vtd cousubfp placefp tract ; if sumlev='750' then if totpop; *--omit empty blocks---; if sumlev='700' then areaname=compress(areaname,'*'); *--remove those trailing asterisks--; if sumlev='050' then call symput('title3',areaname); asianpi1=asian1+hawnpi1; *---add indentation for areaname based on "level" to help see hierarchy in report--; select (sumlev); when('700') if length(areaname) gt 24 then do; areaname=tranwrd(areaname,'Voting District','VTD'); *--others?---; end; when('710') areaname=' '||areaname; when('720') areaname=' '||areaname; when('730') areaname=' '||areaname; when('740') do; areaname=tranwrd(areaname,'(part)',' '); areaname=' '||areaname; end; when('750') areaname=' '||areaname; otherwise; end; run; %end; %*--if &reptonly do group--------------------; *--Forget pdf format until it becomes consistent and flexible. Maybe next release.-----*; ***ods printer pdf file="&htmldir/c&county..pdf" ; proc printto print="&htmldir/c&county..txt" new; options pageno=1; proc report data=rpt&county split='/' headline headskip spacing=1 ls=132 ps=60; columns sumlev areaname ('-Geocodes-' vtd cousubfp placefp tract bg block) ('-Total-' totpop over18 hisppop) ('-Race Alone-' white1 black1 asianpi1 indian1) blovr182 multrace; define sumlev / 'Geo/Unit' spacing=0 format=$gu2. width=4; *define areaname / format=$char24. 'Area/ Summarized'; define areaname / format=$char24. 'Area/ Summarized'; define vtd / 'VTD' format=$char3.; define cousubfp / 'MCD' format=$char5.; define placefp / 'Place' format=$char5.; define tract /'Tract' format=$char7.; define bg / 'BG' format=$1. width=2; define block /'Blk' format=$char4. width=4; define totpop /display spacing=2 'Persons' format=comma7. ; define over18 /display 'Over 18' format=comma7.; define hisppop / display 'Hispanic' format=comma8.; define white1 /display 'White' spacing=2 format=comma6.; define black1 / display 'Black' format=comma6.; define asianpi1 /display 'Asian/or PI' format=comma6.; define indian1 / display 'Amercn/Indian' format=comma6.; define blovr182 / display 'Black /Over18/ (2)' format=comma7.; define multrace / display format=comma5. 'Multi/Race'; run; ***ods printer close; proc printto; run; %mend docnty; options mprint; %docnty(29047,Clay County,reptonly=1); options nomprint; /*<=========================Comment out===================================== %docnty(29001,Adair County ); %docnty(29003,Andrew County ); %docnty(29005,Atchison County ); %docnty(29007,Audrain County ); %docnty(29009,Barry County ); %docnty(29011,Barton County ); %docnty(29013,Bates County ); %docnty(29015,Benton County ); %docnty(29017,Bollinger County ); %docnty(29019,Boone County ); %docnty(29021,Buchanan County ); %docnty(29023,Butler County ); %docnty(29025,Caldwell County ); %docnty(29027,Callaway County ); %docnty(29029,Camden County ); %docnty(29031,Cape Girardeau County ); %docnty(29033,Carroll County ); %docnty(29035,Carter County ); %docnty(29037,Cass County ); %docnty(29039,Cedar County ); %docnty(29041,Chariton County ); %docnty(29043,Christian County ); %docnty(29045,Clark County ); %docnty(29047,Clay County ); %docnty(29049,Clinton County ); %docnty(29051,Cole County ); %docnty(29053,Cooper County ); %docnty(29055,Crawford County ); %docnty(29057,Dade County ); %docnty(29059,Dallas County ); %docnty(29061,Daviess County ); %docnty(29063,DeKalb County ); %docnty(29065,Dent County ); %docnty(29067,Douglas County ); %docnty(29069,Dunklin County ); %docnty(29071,Franklin County ); %docnty(29073,Gasconade County ); %docnty(29075,Gentry County ); %docnty(29077,Greene County ); %docnty(29079,Grundy County ); %docnty(29081,Harrison County ); %docnty(29083,Henry County ); %docnty(29085,Hickory County ); %docnty(29087,Holt County ); %docnty(29089,Howard County ); %docnty(29091,Howell County ); %docnty(29093,Iron County ); %docnty(29095,Jackson County ); %docnty(29097,Jasper County ); %docnty(29099,Jefferson County ); %docnty(29101,Johnson County ); %docnty(29103,Knox County ); %docnty(29105,Laclede County ); %docnty(29107,Lafayette County ); %docnty(29109,Lawrence County ); %docnty(29111,Lewis County ); %docnty(29113,Lincoln County ); %docnty(29115,Linn County ); %docnty(29117,Livingston County ); %docnty(29119,McDonald County ); %docnty(29121,Macon County ); %docnty(29123,Madison County ); %docnty(29125,Maries County ); %docnty(29127,Marion County ); %docnty(29129,Mercer County ); %docnty(29131,Miller County ); %docnty(29133,Mississippi County ); %docnty(29135,Moniteau County ); %docnty(29137,Monroe County ); %docnty(29139,Montgomery County ); %docnty(29141,Morgan County ); %docnty(29143,New Madrid County ); %docnty(29145,Newton County ); %docnty(29147,Nodaway County ); %docnty(29149,Oregon County ); %docnty(29151,Osage County ); %docnty(29153,Ozark County ); %docnty(29155,Pemiscot County ); %docnty(29157,Perry County ); %docnty(29159,Pettis County ); %docnty(29161,Phelps County ); %docnty(29163,Pike County ); %docnty(29165,Platte County ); %docnty(29167,Polk County ); %docnty(29169,Pulaski County ); %docnty(29171,Putnam County ); %docnty(29173,Ralls County ); %docnty(29175,Randolph County ); %docnty(29177,Ray County ); %docnty(29179,Reynolds County ); %docnty(29181,Ripley County ); %docnty(29183,St. Charles County ); %docnty(29185,St. Clair County ); %docnty(29186,Ste. Genevieve County ); %docnty(29187,St. Francois County ); %docnty(29189,St. Louis County ); %docnty(29195,Saline County ); %docnty(29197,Schuyler County ); %docnty(29199,Scotland County ); %docnty(29201,Scott County ); %docnty(29203,Shannon County ); %docnty(29205,Shelby County ); %docnty(29207,Stoddard County ); %docnty(29209,Stone County ); %docnty(29211,Sullivan County ); %docnty(29213,Taney County ); %docnty(29215,Texas County ); %docnty(29217,Vernon County ); %docnty(29219,Warren County ); %docnty(29221,Washington County ); %docnty(29223,Wayne County ); %docnty(29225,Webster County ); %docnty(29227,Worth County ); %docnty(29229,Wright County ); %docnty(29510,St. Louis city ); ===========================End commented out================================ */