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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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