x cd /mscdc/sas/formats/Tools; %let pgm=comet96; filename pgm "&pgm..sas"; *--create the revised format codes $comet96_ and $metro96_ using the 94 codes with additions/changes (as documented on CB web site in ../population/estimates/metro-city/maupdate.txt, 4-97 . Updates as of 6-30-96--; %libname(popests) libname library clear; libname library '/mscdc/sasctlgs'; *<--save in library.formats catalog; *--create custom format codes to assign and name the metro areas--; proc format library=library; value $comet96_ '04005', '49025'='2620M' '28035','28073'='3285M' /* should have been added earlier. effective 7-1-94 */ '08077'='2995M' /* these were added for 6-95 */ '05031'='3700M' /* Jonesboro, AR 6-96 */ '16005'='6340M' /* Pocatello, ID 6-96 */ '47023'='3580M' /* Chester,TN added to Jackson MSA */ other=[$comet94_]; value $metro96_ '2620'='Flagstaff,AZ-UT' '2995'='Grand Junction, CO' '3285'='Hattiesburg, MS' /* effective 7-1-94 */ '3290'='Hickory-Morganton-Lenoir, NC' '5602'='New York CMSA + New Haven et al NECMA' '3700'='Jonesboro, AR' '6340'='Pocatello, ID' other=[$metro94_]; run; *---test against the codes in the latest population estimates data set---; data problems; set popests.uscom96(keep=county msacmsa pmsa areaname slvl); where slvl='050'; length problem $24; length matest $5; matest=put(county,$comet96_.); drop slvl matest; if matest=county and msacmsa eq ' ' then; else if substr(matest,1,4) ne msacmsa then problem='comet lookup'; if (substr(matest,5,1)='C' and pmsa=' ') or (substr(matest,5,1)='M' and pmsa ne ' ') then problem='CMSA/MSA category'; if problem ne ' ' then output; ****; if problem ne ' ' then put /_all_; problem=' '; if msacmsa ne ' ' and put(msacmsa,$metro96_.)=msacmsa then problem='MSACMSA not in metro96'; if problem ne ' ' then output; run; proc print data=problems; title2 'Problem Cases With County-Metro Codes'; run;