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

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

1 ACCEPTED SOLUTION

Accepted Solutions
GraphGuy
Meteorite | Level 14

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;

 

sgm070.png

View solution in original post

4 REPLIES 4
GraphGuy
Meteorite | Level 14

Have you seen it documented anywhere that Proc Gmap can use a 'threecolorramp' from an ODS style?

 

bstarr
Quartz | Level 8

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

GraphGuy
Meteorite | Level 14

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;

 

sgm070.png

bstarr
Quartz | Level 8

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 4 replies
  • 1304 views
  • 2 likes
  • 2 in conversation