BookmarkSubscribeRSS Feed
BTAinRVA
Quartz | Level 8

I'm a real newbie to Proc Gmap but I managed to create a color-coded zip-code level map of Virginia using the paper by Barbara Okerson. Now I want to overlay a county level map. What is the best way to do this?

Thanks,

Brian

2 REPLIES 2
GraphGuy
Meteorite | Level 14

Hi BTA,

This must be destiny, because I was creating an example that overlays a county outline onto a zipcode map, just yesterday! Smiley Happy  Here is a link to the output, and the SAS code:

http://robslink.com/SAS/democd69/wake_county_demographics.htm

http://robslink.com/SAS/democd69/wake_county_demographics_info.htm

wake_county_demographics.png

Basically, you let gmap draw the zipcode map, and then use 'annotate' to draw the extra level of borders (such as county or state outlines). There are 2 techniques for creating the annotate outlines (that I've seen) ... the simpler technique assigns the annotate 'poly' function to the first data-point of each area's outline, and then annotate 'polycont' function to the other data-points of the areas. A slightly more complex algorithm using annotate 'move' & 'draw' has a slightly more complex algorithm, and handles complex maps with 'holes' and such in it.

When using this technique, you need to make sure that your zipcode map, and the map you're going to use for the annotated border are both in the same units (lat/long in degrees or radians, and the longitude has to be in eastlong or westlong). Once they're in the same coordinate system, combine them and Proc Gproject them together.

This is described in more detail in Example 12 in my book SAS/Graph: Beyond the Basics, using the following example (which annotates a state border onto a county map):

http://robslink.com/SAS/book/example12.htm

http://robslink.com/SAS/book/example12_info.htm

BTAinRVA
Quartz | Level 8

Robert,

Thank you so much. That is excatly the kind of thing I'm looking for. I've been playing around trying to incorporate some of your code into mine but when I run the gmap proc I get a mess of error messages about the X Y coordinates not being in range. I suspect it has something to do with proc gproject, with which I am totally unfamiliar. But I'll keep plugging away!

Thanks again!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2769 views
  • 1 like
  • 2 in conversation