12-02-2015 11:24 AM
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;
12-02-2015 11:53 AM
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.
12-02-2015 01:12 PM
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.
12-02-2015 01:16 PM
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).
12-02-2015 02:38 PM
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.
12-02-2015 02:09 PM
Thanks for your help! I know think I have a working version of my map! Really appreciate your time and especially the document you sent.
Need further help from the community? Please ask a new question.