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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 46 replies
  • 5120 views
  • 3 likes
  • 4 in conversation