x cd /pub/data/georef/Tools; %let pgm=mocogeosYY; filename pgm "&pgm..sas"; *---New setup, adapted from mocogeos10, that can be rerun each year in July to update metro/micro codes and latest pop estimate--; *--New for 2014 are the variables MetroSA and MicroSA. For convenience we store these copies of the cbsa codes base on cbsatype--; %let year=2014; %let yr=%substr(&year,3,2); %let yrm1=%eval(&yr -1 ); *---See the setup in mocogeos.sas for creation of base georef.mocogeos dataset. This new 2014 version will be different as follows: 1. cbsa (and modot?) codes updated to 2014 (July 1) values. 2. Each of the regions is stored as a code and as a Name variable, differing by using a format spec to get name. (This varied in old mocogeos set). 3. Now called mocogeos14. The old mocogeos (and mocogeos10) will still exist, for a while at least. 4. pop10 added with 2010 pop from sf1, pop13 added from latest popests.mocom13. 5. Adding areasqmi, landsqmi, intptlat and intptlon from sf1 headers, 2010 census. 6. cbsa and related codes added from georef.cbsacos. cbsayr is new (value 2013). 7. ---*; libname georef '/pub/data/georef'; libname sf12010x '/pub/data/sf12010x' access=readonly; libname sf1x (sf12010x); title "georef.mocogeos10: High Level Geocodes for Missouri Counties, Rev to 2010 Geography"; title2 "Revised August, 2012"; *<===============; footnote 'Report Produced by OSEDA, U. of Missouri Outreach and Extension'; *---Special 1-time step to create georef.umxcodes14, based on the georef.umxcodes data set that we created using fsedit where we manually entered the 3-digit UMX codes (the new ones assigned circa 2013) as well as an Ew flag for distinguishing the 2 urban regions, which we have decided to treat as separate for the purpose of data. ---; *--use $umx2_ to do a lookup of new umx2 codes using 3-digit code as input. Note that we use 98e and 98w instead of 988. We made these up, as well as the 2-character codes UE and UW-; proc format; value $umx2_ 908='SE' 918='EC' 928='NE' 938='NW' 958='SW' 968='WC' '98E'='UE' '98W'='UW' ; value $umxname 908='Southeast' 918='East Central' 928='Northeast' 938='Northwest' 958='Southwest' 968='West Central' '98E'='Urban East' '98W'='Urban West' ; run; data georef.umxcodes14(label="New and old UM Extension Codes circa 2014"); set georef.umxcodes; UMX=umxnew; if UMX='988' then UMX='98'||upcase(Ew); length UMXname $16; UMXname=put(umx,$umxname.); UMX2=put(umx,$umx2_.); keep fipco umx umx2 umxname umxold; label umxold='Old (pre-2013) UMX code'; run; proc sort data=georef.umxcodes14 out=byumx; by umx fipco; run; proc print data=byumx; by umx umxname; id umx umxname; var fipco umx2; format fipco $mocnty.; run; data georef.mocogeos14(label='Mo County Geocodes, 2010'); length areaname $16. SumLev $3 State $2 fipco county $5 pop90 pop2k pop10 popjl&yrm1 5 DED_Region DED_RegionName $3 RPC RPCName $2 UMX UMXName $16 UMX2 $2 dot dotName$2 aaa aaaName $2 CBSA CBSAName $5 CBSAtype $5 msa90 msa2k msa2kName $4 rpc02 $2 cnty $3; merge georef.mocogeos(drop=cbsa in=ingeos ) georef.umxcodes14(rename=(fipco=county)) sf1x.moselectedinv(keep=county sumlev TotPop Areasqmi LandSQMI Intpt: where=(sumlev='050') rename=(TotPop=Pop10) in=insf1) popests.mocom&yrm1(in=inpopests keep=county popjl&yrm1 cbsa MetroDiv cbsaname cbsatype cbsayr firstobs=2) ; *--firstobs spec on popests is to ignore state totals obs---; *---NOTE: we merge data from georef.cbsacos when we create popests.mocom&yrm1 ---; by county; if not (ingeos and insf1 and inpopests) then do; put / _all_; abort abend; end; if cbsa='99999' then cbsa=' '; *--for consistency with earlier versions----; format pop90 pop2k pop10 popjl&yrm1 comma7.; DED_regionName=DED_region; RPCName=rpc; dotName=dot; aaaName=aaa; CBSAName=cbsa; msa2kName=msa2k; format County $mocnty16. DED_region $3. DED_RegionName $dedrgn. rpcName $rpcname. dot $2. dotName $modot. aaaName $aaa. cbsa $5. cbsaName $cbsa. msa2kName $metro. ; *--New, for 2014: we create separate variables for Metropolitan and Micropolitan SAs --; if cbsatype='Metro' then MetroSA=cbsa; else if cbsatype='Micro' then MicroSA=cbsa; label MetroSA='Metropolitan Stat Area' MicroSA='Micropolitan Stat Area'; ***drop _: ; run; options ls=160 ps=120; proc print data=georef.mocogeos&yr; by state sumlev; id fipco county; sum pop90 pop2k pop10 popJL&yrm1; title3 "Listing of the Dataset georef.mocogeos&yr"; run; proc tabulate data=georef.mocogeos&yr missing; *--some summary stats by various levels--; *class dotName ded_regionName msa2kName cbsaName rpcName aaaName; class cbsa rpc umx; format cbsa $cbsa. rpc $rpcname. umx $umxname. ; var pop2k pop10 popjl&yrm1; *** format msa2k $metro. cbsa $cbsa. rpc rpc02 $rpcname. ; table all='Missouri Totals' cbsa rpc umx, pop10=' '*(n='# cntys'*f=5. sum='2010 Pop'*f=comma9.) popjl&yrm1=' '*(sum="20&yrm1 Pop"*f=comma9.) ; title3 'Summaries for Various County-Based Regions'; run;