BookmarkSubscribeRSS Feed
ballardw
Super User

@tarkom wrote:

@GraphGuySounds good. I actually thought I could do all at once. But I will do them individually.

 

Thank you very much


One approach would be to have a control data set with information that changes for each map and use call execute statements to build the code associating a set of Pattern statements with specific map similar to this:

data control;
   informat var $32 color1-color5 $30;
datalines;
No_Exercise  CX90B0D9 CX6E86A6 CX4C5D73 CX2A3440  CX121519
Few_Fruit_Veg verylightred lightred red darkred verydarkred
;
run;

data _null_;
   set control;
   /*creates the pattern statements from the data set*/
   call execute ("Pattern1 v=s c="|| color1 ||";");
   call execute ("Pattern2 v=s c="|| color2 ||";");
   call execute ("Pattern3 v=s c="|| color3 ||";");
   call execute ("Pattern4 v=s c="|| color4 ||";");
   call execute ("Pattern5 v=s c="|| color5 ||";");
   /* boilerplate of the gmap call*/
   call execute ("proc gmap data = final(rename = (State_FIPS_Code = State)) map = mymap;
      id State;
      choro  ");
   /*variable name*/
   call execute(var);
   /*remainder of boilerplate*/
   call execute (" /
     levels = 4  legend = legend1 statistic = mean;
      run;
      quit;");
run;

Obviously array processing could be used to create the pattern statements. Your control data set could also contain more interesting title information to use in a title statement(s).

 

If you presummarize the variables you wound not need the "statistic=mean" and that automatically generated title part would go away.

 

I would likely change to an HLS color naming system as then you could specify a single HUE value for each variable and use the same Lightness and Saturation settings across the same 5 pattern statements. Which yield different colors but range of the shading would be similar.

This might even allow the idea of grouping your variables to have similar base hues if they were related.

tarkom
Obsidian | Level 7

@ballardwWow!!! Sounds interesting...

 

I will work through that as well to see what I get. 

 

I appreciate your inpute.

 

Thank you

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
  • 46 replies
  • 2461 views
  • 3 likes
  • 4 in conversation