Data visualization with SAS programming

Create Static Choro GMAP

Frequent Contributor
Posts: 84

Create Static Choro GMAP

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%"




  5="70% and Up";


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



  format Change Change_Groups.;

  id maparea;

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



Grand Advisor
Posts: 9,748

Re: Create Static Choro GMAP

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.

Frequent Contributor
Posts: 84

Re: Create Static Choro GMAP

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.

SAS Employee
Posts: 963

Re: Create Static Choro GMAP

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;


proc gmap data=Data_Proj;

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:

Post a Question
Discussion Stats
  • 3 replies
  • 3 in conversation