I'm working on a map that overlays the 2010 Core Based Statistical Areas (CBSAs) with the US county boundaries. I've imported the CBSA shapefiles from the US Census websites and am trying to combine it with the SAS supplied maps.counties dataset.
However, when I combine the two I get an error message that says "data system requrested, but value is not on graph 'X', 'Y'. I'm a bit confused about what I have done wrong. When I run proc gmap without the maps.counties overlay. I get the CBSA boundaries.
Below is a sample of my code.
/*Importing ESRI file*/
proc mapimport datafile=usdata out=cbsa10;run;
/*restricting CBSA boundaries to continental US*/
if state in ("AK","HI","PR") then delete;
data anno_county; set maps.counties (where=(state not in (02,15,72)));
length function color $8;
xsys='2'; ysys='2'; hsys='3'; when='a';
if _n_=1 then function='poly';
set cbsa10b (drop=state) anno_county;
data cbsa10b anno_county; set combined;
if anno_flag=1 then output anno_county;
else output cbsa10b;
if ST in ("AK","HI","PR") then delete;
proc gmap all data=mydata2 map=cbsa10b all anno=anno_county;
choro myvariable / discrete coutline=black;
The SAS-supplied maps.counties x/y coordinates are in westlong radians.
What type of coordinates are the x/y variables in your map?
In order to overlay the maps.counties borders using annotate, the x/y of the map & annotate need to be using the same coordinate system.
Thanks for your reply. You are right. My coordinates were not westlong radians. From some of your previous codes, I found the conversation formula and converted the coordinates from the CBSA map. I then combined the dataset and added a project gproject step. However, the county boundaries aren't showing up on my map - only the CBSA boundaries.
I will review the annotate link you sent and see if that helps with why the county boundaries are not showing up.
It might be useful to use Proc Gplot to plot the x/y of your map, and then use it to plot the x/y of your annotate dataset ... I suspect you will see that they cover different ranges of values, and have no overlap (this is why the annotate is not showing up). Gmap will only show you the range of values that the map occupies (if the annotate has x/y coordinates outside of the map's x/y range, then the annotate will not show up).
Sorry to bother you again - but now I have another question. All in all my map looks great thanks to your help. However, I noticed that my boundaries are slightly off. Perhaps its from the X/Y coordinates supplied in the CBSA shape files? Any suggestions on how to line things up better? Attached is my current working version of the maps.
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.