x cd /pub/data/corrlst/Tools; %let pgm=usplco2k; filename pgm "&pgm..sas"; *---This is a followup to the place_to_county setup in this directory, which created corrlst.usplco2k. Here we use that dataset to generate a pdf report and the $uspl2co sas format code for looking up primary counties for places. Oct. 2002 John Blodgett, OSEDA, U. of Missouri Outreach & Extension ---*; title "&pgm Places Linked to County Per 2000 Census -- Entire US"; options nodate; libname corrlst '/pub/data/corrlst'; filename text '/pub/sas/formats/Suspl2co.sas'; libname user '/SAS_temp/user'; /*<=========================Comment out===================================== *----step 1: genreate the format code linking state-placefp to primary fips county code---; data fmt; set corrlst.usplco2k; by state placefp descending pop100; if first.placefp; run; %genfmat(setin=fmt,argvars=state placefp, arglen=7, labelvar=county, labellen=5, other=99999, fmatname=uspl2co ) run; ===========================End commented out================================ */ *---Step 2: The report----; %let title=Places in United States Linked to Counties; ****ods output did not work for some reason. It could not fit the data on a single line and breaking it up made it unreadable; ***The problemlm went away when we stopped using our home-grown styles. We go with the SAS default now.--; ods listing close; ods html file='/pub/reports/geography/us_place_to_county.html'(title='MCDC Place to County, 2000') style=minimal; ods pdf file='/pub/reports/geography/us_place_to_county.pdf' title='MCDC Place to County, 2000' ; **options orientation=portrait; *<---will effect pdf output-------; options orientation=portrait; *<---will effect pdf output-------; options nodate pageno=1 number ls=132 ps=58; title "&title"; title2 "Showing 2000 Complete Count Population of Intersections"; %let source=%str(2000 Decennial Census, Public Law 94 (Redistricting) File); data report; length State $32 placefp $5 Place $7 fipco $5 county $5 pop100 8 afact 8; set corrlst.usplco2k; Place=trim(state)||placefp; **** where state le '04'; state=trim(state)||' '||put(state,$state.); fipco=county; afact=100*afact; *--convert from ratio to percentage for report--; keep state--afact; run; proc report data=report nofs headskip style(column)=[asis=ON] ; by state; column ('Place' placefp place) ('County' fipco county) ('2000 Pop in Place-County' pop100 afact); define Placefp / display 'FIPS' format=$5.; define Place / display 'Name' format=$fplace28. ; define fipco/display 'FIPS' format=$5.; define county/display 'Name' format=$county18. ; define pop100 /display width=12 'Persons' format=comma9.; define afact / display width=11 '% in County' format=4.; compute after / style=[font_face=arial font_size=1 foreground=gray]; line ' '; line "Source: &source"; line "Report Produced on &sysdate9 by the Missouri Census Data Center"; line "From setup in corrlst/Tools/&pgm..sas"; line "NOTE: First County Listed for a Place is the Primary County"; endcomp; run; ods html close; *** ods pdf close;