Hello,
I am trying to create a choropleth map on a three color gradient scale. I am defining the colorramp through proc template (following this guide http://support.sas.com/kb/41/776.html). I can replicate the example and change colors in the twocolorramp, but as soon as I change the style to threecolorramp, the coloring appears to revert to default. Am I missing something in the threecolorramp statement or elsewhere?
ods path(prepend) Work.Templat(update);
goptions reset=all;
goptions gunit=pt htitle=14 htext=8 ftitle="arial" ftext="arial/bold" cback='white';
proc template;
define style styles.colorramp;
parent=styles.default;
/* Define a lighter and darker shade of blue for the starting and ending colors. */
/* style twocolorramp / startcolor=cxF3F7FE endcolor=cx6497EB;*/
style threecolorramp / startcolor=cxFF0000 neutralcolor=cxF3F7FE endcolor=cx6497EB;
end;
run;
ods listing style=styles.colorramp;
proc gmap data=maps.us map=maps.us;
id state;
choro state;
run;
quit;
I am using SAS 9.4 TS1M6.
Thanks for any help in advance,
-Brian
Here's a way to get a 3-color color ramp, if you use Proc SGmap (instead of Proc Gmap), and if you have the latest version (found in Viya 3.5), which has support for the colormodel= option:
proc sgmap maprespdata=sashelp.us_data mapdata=mapsgfk.us;
choromap population_2010 / mapid=statecode id=statecode
colormodel=(cxFF0000 cxF3F7FE cx6497EB);
run;
Have you seen it documented anywhere that Proc Gmap can use a 'threecolorramp' from an ODS style?
Hi Dr. Allison,
I did not see documentation specifically on using threecolorramp in PROC GMAP. I only saw it for PROC TEMPLATE and just assumed that if twocolorramp works, then threecolorramp should work as well. Since I was having issues with that, I thought perhaps my assumption was misguided, which is why I turned to SAS communities 🙂
Thanks for your help,
-Brian
Here's a way to get a 3-color color ramp, if you use Proc SGmap (instead of Proc Gmap), and if you have the latest version (found in Viya 3.5), which has support for the colormodel= option:
proc sgmap maprespdata=sashelp.us_data mapdata=mapsgfk.us;
choromap population_2010 / mapid=statecode id=statecode
colormodel=(cxFF0000 cxF3F7FE cx6497EB);
run;
Hello Dr. Allison,
Thank you for replying to my post. This looks like an excellent solution and I will work with the map more in SGMAP rather than GMAP. Unfortunately, my organization does not have Viya so I get an error when trying the colormodel= option.
Thank you for your help on this!
-Brian
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.