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

Hi guys, I have a question about PROC GMAP. I am drawing a heatmap and I have some provinces no case which I have regard as missing and the data is '.'. After that, I want to divide the rest of the data into 5 groups :[0-0.2], (0.2-0.4]... until (0.8,1]. Therefore I use "midpiont 0.1 to 0.9 by 0.2 Range". However, the heatmap does not give me a missing part but a "0.45-0". I am quite confused and do not know how to solve it.  

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@Eco wrote:

Hi guys, I have a question about PROC GMAP. I am drawing a heatmap and I have some provinces no case which I have regard as missing and the data is '.'. After that, I want to divide the rest of the data into 5 groups :[0-0.2], (0.2-0.4]... until (0.8,1]. Therefore I use "midpiont 0.1 to 0.9 by 0.2 Range". However, the heatmap does not give me a missing part but a "0.45-0". I am quite confused and do not know how to solve it.  


From the documentation:

RANGE

causes GMAP to display, in the legend, the starting value and ending value of the range around each midpoint specified with the MIDPOINTS= option

So what that means is the displayed value will be the actual largest and smallest value that occurs in your data for the interval.

If you want to show specific ranges in the legend then you will need to work on the legend and not rely on the RANGE option, especially if you want a "missing" entry. A custom format assigned to the actual midpoints specified often works such as:

proc format library=work;
value ratio
. = 'Missing'
.1= '[0-0.2]'
.3='(0.2-0.4]'
.5='(0.4-0.6]'
.7='(0.6-0.8]'
.9='(0.8-1]'
;
run;

proc gmap map= GreatChina data= p2pdata1;
    id id;
   title' Platform Collapse Rate';
    choro ratio/  legend=legend1 
                  coutline=gray44  
                  anno=anno_label 
                  midpoints= .1 TO .9 BY .2 
/*                  range */
                  missing
   ;   
   format ratio ratio.;
run;
quit;

You may need to work with your legend code and the format definition a bit to get desired alignments

 

 

 

 

View solution in original post

9 REPLIES 9
Eco
Calcite | Level 5 Eco
Calcite | Level 5

Here is the Data set and the final graph. You can see that 0.45-0, it should be the position for MISSING.捕获.PNG

Madelyn_SAS
SAS Super FREQ

You posted this question to the SAS Visual Analytics community, which does not seem like the correct location. Are you using SAS Visual Analytics? Or are you just using PROC GMAP code? 

Eco
Calcite | Level 5 Eco
Calcite | Level 5
Sorry, I think it is only related to GMAP. This is my first time to use the community.
Reeza
Super User
I've moved the post to the graphics forum.
Eco
Calcite | Level 5 Eco
Calcite | Level 5
Thank you very much~Sorry for the inconvenience.
ballardw
Super User

@Eco wrote:

Hi guys, I have a question about PROC GMAP. I am drawing a heatmap and I have some provinces no case which I have regard as missing and the data is '.'. After that, I want to divide the rest of the data into 5 groups :[0-0.2], (0.2-0.4]... until (0.8,1]. Therefore I use "midpiont 0.1 to 0.9 by 0.2 Range". However, the heatmap does not give me a missing part but a "0.45-0". I am quite confused and do not know how to solve it.  


From the documentation:

RANGE

causes GMAP to display, in the legend, the starting value and ending value of the range around each midpoint specified with the MIDPOINTS= option

So what that means is the displayed value will be the actual largest and smallest value that occurs in your data for the interval.

If you want to show specific ranges in the legend then you will need to work on the legend and not rely on the RANGE option, especially if you want a "missing" entry. A custom format assigned to the actual midpoints specified often works such as:

proc format library=work;
value ratio
. = 'Missing'
.1= '[0-0.2]'
.3='(0.2-0.4]'
.5='(0.4-0.6]'
.7='(0.6-0.8]'
.9='(0.8-1]'
;
run;

proc gmap map= GreatChina data= p2pdata1;
    id id;
   title' Platform Collapse Rate';
    choro ratio/  legend=legend1 
                  coutline=gray44  
                  anno=anno_label 
                  midpoints= .1 TO .9 BY .2 
/*                  range */
                  missing
   ;   
   format ratio ratio.;
run;
quit;

You may need to work with your legend code and the format definition a bit to get desired alignments

 

 

 

 

Eco
Calcite | Level 5 Eco
Calcite | Level 5

I see...It seems I go to the wrong way. Thank you for your recommendation~

ballardw
Super User

@Eco wrote:

I see...It seems I go to the wrong way. Thank you for your recommendation~


Not exactly wrong just not quite understanding the options involved.

 

I spent a lot of time making different maps, often getting things not quite as I needed, learning some of the interactions of the options.

 

The RANGE option is very useful when you do not want specific values to appear in the legend. I will typically use it more often in the beginning stages of working with new data or client requests while exploring possible options for designing a display. Also it is very appropriate to use RANGE with the LEVELS option and especially when doing BY group processing where you might make a series of maps on related topics such as sales totals of different products. You would very likely want the legend to display the actual range of values represented by the map colors in that case.

GraphGuy
Meteorite | Level 14

You have one work-around in hand, but I would propose another ...

 

Rather than hard-coding the all the ranges in a user-defined-format, I would recommend just over-riding the bad range for the first (missing) value in the legend statement. The t=1 specifies the first item in the legend, and the '.' is the value you want to show there instead of the default.

 

legend1
origin=(2,10) pct
mode=share
across=1
label=none
value=(j=r t=1 '.')
shape=bar(3,4) pct;

 

proc gmap map= GreatChina data= userdata.p2pdata1;
id id;
title' Platform Collapse Rate';
choro ratio /
legend=legend1
coutline=gray44
anno=anno_label
midpoints= .1 TO .9 BY .2
range 
missing;
run;

eco_heatmap.png

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 9 replies
  • 2372 views
  • 0 likes
  • 5 in conversation