BookmarkSubscribeRSS Feed
P5C768
Obsidian | Level 7

I'm trying to create a basic heat map by regions using proc GMAP.  I would like to create five fixed choro ranges that don't change, even if values aren't available for that particular month (i.e. in the code below, there are no values under 40% or above 70%).  I created a ranking variable in my data set ("Change") to be modified by the proc format and in the choro statement.  However, the choro continues to work on the range of available values, ignoring the format.  Any help is appreciated.  Thanks!

proc format;

  value Change_Groups

  1="Under 40%"

  2="40%-49%"

  3="50%-59%"

  4="60%-69%"

  5="70% and Up";

run;

pattern1 v=ms c=Green;

pattern2 v=ms c=Lig;

pattern3 v=ms c=Yellow;

pattern4 v=ms c=Red;

pattern5 v=ms c=Maroon;

proc gmap

  map=Data_Proj

  data=Data_Proj;

  format Change Change_Groups.;

  id maparea;

  choro Change / levels=6 legend=legend1 coutline=black html=Data_html;

run;

quit;

3 REPLIES 3
ballardw
Super User

Are your change values actually in the map data set? If so try creating a separate data set with the change varaible and the appropriate Id variable only and use it as the Data=dataset.

P5C768
Obsidian | Level 7

The variable is in the data set, but I want it to format based on variable that may or may not be in that variable.  For example, I want a green shade for any values under 40%, so if there are not any values under 40%, I don't want green to show up.

GraphGuy
Meteorite | Level 14

Note that your map= data set should be a map, and the data= data set should be your response data.

I think you will want to use code something like the following (this is not complete code, but should get you going in the right direction):

data Data_Proj; set Data_Proj;

if Change<.4 then change_category=1;

else if Change<.49 then change_category=2;

else if Change<.59 then change_category=3;

else if Change<.69 then change_category=4;

else change_category=5;

run;

proc gmap data=Data_Proj map=maps.us;

format change_category Change_Groups.;

choro change_category / midpoints= 1 2 3 4 5;

quit; run;

I also recommend getting a good understanding of the gmap fundamentals, by reading Mike Zdeb's excellent book:  http://www.amazon.com/Maps-Made-Using-Carpenters-Software/dp/1590470931

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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