Does anyone know of an existing (SAS or other) 3-digit zip code (zcta) data set? If not, what steps are needed to convert a 5-digit zip code data set to a 3-digit data set? (NOTE: I have the TigerLine 2013 US ZCTA510 data.) I believe it must be more than creating a new variable (3-digit zip code) from the existing 5-digit zip code.
Here's some code that imports a zcta boundary map, plots the zctas colored by zip3 ... and then gremoves the internal borders, and plots the zip3 polygons. This should be a good starting-point to get you going:
proc mapimport datafile="../democd17/zt37_d00.shp" out=zcta_map; id zcta; run; proc gproject data=zcta_map (rename=(x=long y=lat)) out=zcta_map eastlong latlong degrees; id zcta; run; data zcta_map; set zcta_map; zip3=substr(zcta,1,3); run; proc gremove data=zcta_map out=zcta3_map; by zip3; id zcta; run;
title ls=1.5 "NC Zip Code Map, Colored by zip3"; proc gmap data=zcta_map map=zcta_map all; id zcta; choro zip3 / coutline=gray cdefault=cxF5F5DC; run; title ls=1.5 "NC Zip3 Map, Colored by zip3"; proc gmap data=zcta3_map map=zcta3_map all; id zip3; choro zip3 / coutline=gray cdefault=cxF5F5DC; run;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.