BookmarkSubscribeRSS Feed
RandoDando
Pyrite | Level 9

I am wondering how to add an external shapefile overtop a US county map in SAS using GMAP (SGMAP not in my license).  The county choro map I have uses state and county as the IDs, county as the choro variable.  The external shapefile does not have state and county fields, the only corresponding fields are X, Y.  I've used GREMOVE and annotate to add layers in the past, but each time those additional layers already had the same matching ID variables (e.g. state, county) I was using in GMAP.  All I need is an example, and I can go from there.  A google search has yielded nothing helpful. Thanks

3 REPLIES 3
RandoDando
Pyrite | Level 9
OK. I got it to work, BUT I have a slight issue. I imported the shapefile, added lat and Long using the X Y variables, combined it with the map data, projected the combined set, and then split the files back to the Map and anno sets. However, the resulting map is now tilted to the right. Is there any way to remove the tilted earth effect?
RandoDando
Pyrite | Level 9

Solved.  Adding in LONGMAX= (to max long value of the map data) to the GPROJECT statement fixed this. 

GraphGuy
Meteorite | Level 14

I think this example should provide some good tips, similar to what you're wanting to do.

In particular, I recommend using the new(ish) Proc Gproject parmout and parmin parameters, so you can project the map and shapefile/annotate separately (this will probably help you avoid that 'tilt' you mentioned).

 

http://robslink.com/SAS/democd97/hurricane_evacuation.htm

https://robslink.com/SAS/democd97/hurricane_evacuation.sas

 

In this example, the yellow underlying map is a county map, and the colored evacuation zones are annotated (created from a shapefile).

 

hurricane_evacuation5.png

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 833 views
  • 0 likes
  • 2 in conversation