12-23-2015 04:17 PM - edited 12-23-2015 04:18 PM
I have uploaded a Zip code-CBSA crosswalk to SAS and merged it with the Sashelp.zipcode file in order to create a map of individual states at the CBSA level. To merge the two files I had to sort by zip code, and the problem is that the resulting map I created with the merged file (using proc gmap) is all scrambled inside. I know that SAS draws from point to point in the order of observations listed in the data/map files when it's mapping, but I don't know how to sort the dataset I have so that it draws CBSA boundaries nicely. I tried sorting by x and y coordinates individually, but that didn't help. Sorting by CBSA code also didn't help, as the numeric order of CBSA codes doesn't necessarily correspond to where they are geographically (and same goes for zip codes). I know it has to be based on pairs of x,y coordinates, but I don't know how to do this. Any suggestions/recommendations would be more than welcome. Thank you!!
12-23-2015 04:45 PM
12-23-2015 04:33 PM
Thank you for your reply! That is a good idea and definitely makes sense. The only problem is that I'm not sure the SAShelp.Zipcode dataset comes in an order that makes sense for mapping to begin with. If you look at the Maps.State dataset, it's sorted by state, but within each state group, the x,y coordinates are sorted (by SAS, or whoever made the dataset) in a certain way that allows you to draw a map of the U.S. with nice statelines. The SAShelp.Zipcode comes sorted by zip code in ascending numeric order, which doesn't correspond to where they are on the map. I'm not even sure if it's possible to get an answer to this question on here, but I thought it couldn't hurt to ask. Thanks again for replying!
12-23-2015 04:45 PM
12-23-2015 07:26 PM
I think Reeza covered it all, but I can't get to that webpage.
I'm not sure why you want to mix ZIP Codes and CBSA's.
SASHELP.ZIPCODE is a point file and cannot be drawn as a map. It can be used with Annotate.
The CBSA file is a boundary file and can be drawn as a map. They should not be mixed.
There is a ZIP Code-like file from the Census called a ZCTA file. And it is a boundary file.
Now, mixing these will not likely work. CBSAs and ZIP Codes will cover the same area.
12-28-2015 10:34 AM
Thank you for your reply and explanation! I am relatively new to SAS and this is my first time ever trying to map with it, so I apologize if what I'm saying doesn't quite make sense. I didn't want to mix zip codes and CBSAs on a map, if that wasn't clear. I was having trouble finding a CBSA boundary file with x,y coordinates, so I was hoping to use the zip-CBSA crosswalk I had to link zip codes to CBSAs and then draw the map with the x,y coordinates that came with the zip code file. I understand now that the SASHELP.zipcode file isn't a boundary file, so that wouldn't work. Thanks again for your reply!
12-28-2015 11:26 AM
As an update, I was able to get it to work by downloading a shp CBSA file from the Census Bureau website. As you suggested, no zip code file was necessary. Thanks to both of you for your help!
Need further help from the community? Please ask a new question.