BookmarkSubscribeRSS Feed
RandoDando
Pyrite | Level 9

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;
6 REPLIES 6
Reeza
Super User
What version of SAS do you have?SGMAPs produces better quality graphics.
RandoDando
Pyrite | Level 9
I'm using SAS EG 7.13, not sure which version of SAS is on the Metadata server.
Reeza
Super User
this will tell you, check the log.

proc product_status;run;
ballardw
Super User

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?

RandoDando
Pyrite | Level 9

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?  

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 6 replies
  • 1382 views
  • 0 likes
  • 3 in conversation