x cd /pub/data/corrlst/Tools; %let pgm=zip2zcta; filename pgm "&pgm..sas"; *********************NOTE: Problem with these files!! The zcta input field is NOT a true ZCTA in MANY cases!! ******; *---We read the ZIP to ZCTA crosswalk file created by John Snow, Inc. and posted on web at http://udsmapper.org/docs/Zip_to_ZCTA_crosswalk_2010_JSI.xls . (thanks to Ben Winchester for pointing us to this resource). 11-1-15: We are running this again but this time with a vintage 2015 crosswalk input from same source (JT Snow). This file links all 5-digit US ZIP codes to the corresponding ZCTA. For standard residential ZIPs the ZIP and ZCTA should always (?) be the same. But for special "point" ZIPs the ZCTA is the "closest" standard ZIP. E.g, ZIP 65211 is used to deliver mail to the U of Missouri in Columbia, MO. The university is located in an area corresponding to the residential ZIP code 65201. So this dataset would link ZIP 65211 to ZIP code 65101. Useful for encoding files with mailing addresses where you want to associate them with ZCTAs for the purpose of linking to all the useful census data associated with ZCTAs (the poverty rate, the percent African American, the median household income, the urban/rural pop counts, etc. There were 10 duplicates in the input which we eliminated (using nodupkeys in our sort). This setup also creates the Szipzcta.sas format library module which we can use to map ZIPs to ZCTAs. John Blodgett, OSEDA, U of Missouri. Coded and run 5-23-12. We ran it again in 2015 but in 2016 we found serious problems with the 2015 set. The input format had changed and we ran the same code as if it were still 2010. Thanks to Julie Strominger for catching this. jgb, 4-25-16 ---*; filename csvin10 "/pub/data/corrlst/Zip_to_ZCTA_crosswalk_2010_JSI.csv"; filename csvin15 "/pub/data/corrlst/Zip_to_ZCTA_crosswalk_2015_JSI.csv"; filename text "/pub/sas/formats/Szpzcta.sas"; title "&pgm.: ZIP to ZCTA Correspondence Data Sets Per J. Snow"; libname corrlst '/pub/data/corrlst'; data zips; infile csvin10 dsd missover firstobs=2; length ZIP $5 ZIPtype $1 CityName $32 Stab $2 ZCTA $5; input ZIP -- ZCTA; run; proc sort out= corrlst.ZIP_2_ZCTA10(label='ZIP code to ZCTA correspondence circa 2010 per John Snow,Inc') nodupkeys ; by zip; run; proc print data=&syslast (obs=15); title2 "Sample &syslast Observations"; id zip; run; data zips15; infile csvin15 dsd missover firstobs=2 termstr=crlf; length ZIP $5 ZIPtype $1 CityName $32 Stab $2 ZCTA $5; input ZIP CityName stab ziptype zcta; run; proc sort out= corrlst.ZIP_2_ZCTA15(label='ZIP code to ZCTA correspondence circa 2015 per John Snow,Inc') nodupkeys ; by zip; run; proc print data=&syslast (obs=15); title2 "Sample &syslast Observations"; id zip; run; libname sasfmts "/pub/sas/catalogs"; %genfmat(setin=corrlst.ZIP_2_ZCTA15,fmatname=zpzcta,fmatlib=sasfmts,argvar=zip,arglen=5,labelvar=zcta,labellen=5,other=' ') run;