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 2025: Call for Content

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!

Submit your idea!

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
  • 3457 views
  • 3 likes
  • 4 in conversation