BookmarkSubscribeRSS Feed
BC33
Fluorite | Level 6

Hello all, I don't have any issues with getting different marker symbols for the group variable; however, I need to change the color of the symbols based on another variable. 

 

I am familiar with the grouplc option, but my version of SAS, which is 9.4, must not be the most up to date version because this option is not recognized.  

 

Is there a different way to achieve this without the grouplc option?

 

Thanks!

5 REPLIES 5
Reeza
Super User

Run the following to identify your version for starters:

 

proc setinit;run;

Have you tried the STYLEATTRS statement in PROC SGPLOT? Can you provide sample data we can work with?

BC33
Fluorite | Level 6

Running your code, for current version it says 9.04.01M3P062415

 

STYLEATTRS  does help with the styling, but I am not sure specifically how I would achieve what I need using it.  Here is a sample data (not real):

 

IDDATEAGEVALUESUPPORT LEVEL
11/1/201610301
11/3/201711352
22/2/201611352
22/5/201712303
35/14/201710361
35/15/201710313

 

x is Age, y is Value, the group is ID but I need the color to be by support level

DanH_sas
SAS Super FREQ

Is the coloring variable continuous or discrete?

BC33
Fluorite | Level 6

I don't believe it to be continuous.  I used colorresponse and gradlegend in the scatter to switch the coloring to a different variable other than the group.  Now there is a gradient.  As you can see in the sample data above, I don't need a gradient just solid colors, but this is the only way I have found thus far.

 

Thanks!

DanH_sas
SAS Super FREQ

If the number of unique combinations between your two class variables is reasonable, you can use an attributes map to bind unique symbol shapes and colors to each crossing. You will need to create a variable that contains unique values that represents each crossing. Here is a blog post that will give you an introduction to attributes maps if you have not used them: http://blogs.sas.com/content/graphicallyspeaking/2012/02/27/roses-are-red-violets-are-blue/

 

Hope this helps!

Dan

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 5 replies
  • 1731 views
  • 2 likes
  • 3 in conversation