BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
That____Redhead
Fluorite | Level 6

Hello,

I have some code I wrote to create a heat map of the US by state, but having so many states, it's not the most meaningful.  So I have been trying to figure out how to combine certain states in to regions, and color just that area of the country (i.e. Northeast, southwest, etc...)

If anyone knows how to do this, I would really appreciate it!  Thanks!             

1 ACCEPTED SOLUTION

Accepted Solutions
GraphGuy
Meteorite | Level 14

You can assign a 'region' variable to each state, and then use 'Proc Gremove' to create a new map, with the internal borders removed.

Here is an example from the V6 SAS/Graph Examples book (using the county map, rather than the state map... but a similar technique):

http://robslink.com/SAS/democd44/ex_08.htm

http://robslink.com/SAS/democd44/ex_08_info.htm

And here is a simpler example (using maps.us) from the Tech Support website:

http://support.sas.com/kb/25/592.html

View solution in original post

3 REPLIES 3
GraphGuy
Meteorite | Level 14

Do you want to just plot that subset region of the map, or do you want to show the whole map but only color the states in that subset?

Here's one way to subset a map, if that's what you're wanting...

data southeast; set maps.us (where=(statecode in ('NC' 'SC' 'GA' 'FL')));

run;

proc gmap data=southeast map=southeast;

id statecode;

choro state / discrete;

run;

That____Redhead
Fluorite | Level 6

Thanks Robert,

I want to have the US map with multiple states combined into a region.  For example, have NC, SC, GA, FL, AL all lumped as one region.

GraphGuy
Meteorite | Level 14

You can assign a 'region' variable to each state, and then use 'Proc Gremove' to create a new map, with the internal borders removed.

Here is an example from the V6 SAS/Graph Examples book (using the county map, rather than the state map... but a similar technique):

http://robslink.com/SAS/democd44/ex_08.htm

http://robslink.com/SAS/democd44/ex_08_info.htm

And here is a simpler example (using maps.us) from the Tech Support website:

http://support.sas.com/kb/25/592.html

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
  • 3 replies
  • 3630 views
  • 0 likes
  • 2 in conversation