I am trying to create individual state maps (starting with Maine) with color-coded points mapped out using X-Y coordinates. The data set I am using for the points has X and Y coordinates, along with a specified color for the points to be used in the map. This data set also has the same state code used in the map data set. Below is my code. I get no errors, but when I get to GMAP it only draws the state without the points from the anno set. Any help would be appreciated.
data Maine;
set mapsgfk.Us_states;
if state =stfips("ME");
run;
data prop; set ME_MFH2;
xsys='2'; ysys='2'; hsys='3'; when='a';
function='pie'; rotate=360; size=1.0;
style='psolid'; color=color; output;
run;
proc gproject data=prop
degrees
out=propg
parmentry=mapsgfk.Us_states
dupok;
id;
run;
pattern value=mempty color=blue ;
proc gmap
data=maine map=maine all
anno=propg ;
id state;
choro state / nolegend;
run;
quit;
I would suggest that you examine the maximum and minimum values the X and Y variables of your Maine map data set and then separately the same for the annotate dataset Propg.
The parmentry data set you use in the Gproject, parmentry=mapsgfk.Us_states, will have a significantly different range of values than the Maine only set extracted from the US_states data set.
So I suspect that the annotate values may fall outside of Maine after projection. By any chance does you log show any message about such happening?
After some more searching I came across this, and the example seemed to work (all the prior examples I saw were doing things far more complex than what I needed).
http://support.sas.com/rnd/datavisualization/mapsonline/html/geocode_gmap.html
Now, that I have the big part over with I am down to aesthetics. The example used stars are the point symbols, but I prefer solid dots.
Here is the original code copied from the link using stars:
data prop; set ME_MFH2; xsys='2'; ysys='2'; hsys='3'; when='a'; x= -x *(atan(1)/45); y = y* (atan(1)/45); function = 'label'; style = 'special'; text = 'M'; color = color ; size = 2; position = '5'; run;
The TEXT = 'M' specifies stars with the style selected. I've tried putting in 'U' for dots, but I get all sorts of strange symbols on my map. Any idea on how to get the solid dots symbol to work?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.