I am using PROC GMAP for the first time. I need help with changing the way the legends (the 3 levels in the example) are shown in the map.
For example when I am creating a sample US state map in the following way SAS is using three separate levels of colors. Changing the LEVELS = option I can get more levels but the same issue exists. Is there any way to show the density_2020 by different state as a range of 0 to 10,000. (The map should not change only I am trying to show the legends in a different way)
proc gmap data=sashelp.us_data map=mapssas.us;
id state;
choro density_2010 / levels=3 legend=legend1;
run;
quit;
Check @Rick_SAS blog :
https://blogs.sas.com/content/iml/2015/11/18/create-a-map-with-proc-sgplot.html
data US;
set maps.US;
* where StateCode NOT IN ("AK", "HI", "PR");
by State Segment;
if first.Segment then PolyID+1; /* create ID variable for polygons */
run;
title "US States with Some Large Cities";
proc sgplot data=us ;
polygon x=x y=y ID=PolyID / fill outline group=StateCode colorresponse=PolyID colormodel=(verylightblue verydarkblue);
xaxis display=none;
yaxis display=none;
run;
Use the MIDPOINTS and RANGE option
proc gmap data=sashelp.us_data map=mapssas.us;
id state;
choro density_2010 / levels=3 midpoints=100 200 500 range;
run;
quit;
Thank you very much for your help! Is it possible to get the legend in a format like the attached map?
Check @Rick_SAS blog :
https://blogs.sas.com/content/iml/2015/11/18/create-a-map-with-proc-sgplot.html
data US;
set maps.US;
* where StateCode NOT IN ("AK", "HI", "PR");
by State Segment;
if first.Segment then PolyID+1; /* create ID variable for polygons */
run;
title "US States with Some Large Cities";
proc sgplot data=us ;
polygon x=x y=y ID=PolyID / fill outline group=StateCode colorresponse=PolyID colormodel=(verylightblue verydarkblue);
xaxis display=none;
yaxis display=none;
run;
Please read your initial post carefully. You say "the same issue exists" but do not state what the "issue" is.
@dac_js wrote:
I am using PROC GMAP for the first time. I need help with changing the way the legends (the 3 levels in the example) are shown in the map.
For example when I am creating a sample US state map in the following way SAS is using three separate levels of colors. Changing the LEVELS = option I can get more levels but the same issue exists. Is there any way to show the density_2020 by different state as a range of 0 to 10,000. (The map should not change only I am trying to show the legends in a different way)
proc gmap data=sashelp.us_data map=mapssas.us; id state; choro density_2010 / levels=3 legend=legend1; run; quit;
I was looking for a way to get the legend as a scale instead of separate data points. I should have clarified that.
Thank you for the help!
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!
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.