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.
@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
Here is the Data set and the final graph. You can see that 0.45-0, it should be the position for MISSING.
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?
-------------------------------------------------------------------------
Four tips to remember when you contact SAS Technical Support
Tricks for SAS Visual Analytics Report Builders
SAS Visual Analytics Learning Center
@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
I see...It seems I go to the wrong way. Thank you for your recommendation~
@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.
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;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.