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

Hi Folks, 

I'm using proc sgplot in SAS 9.4-1M5. 

Datacolors=green is too dark and Datacolors=lightgreen produces too bright green bars to the plot's background I have to stick to.

Do you know color codes or ways that I can specify in the sgplot for more diverse green options? I need green some where between these dark and bright green options. 

Cruise_0-1650003503160.png

Cruise_1-1650003555503.png

 

 

proc sort data=swimmer; by BOR; run;
PROC SGPLOT DATA=SWIMMER; 
STYLEATTRS DATACOLORS=(LIGHTGREEN YELLOW ROSE);

 Thank you for your time in advance. 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

You can use function Palette() in IML.

proc iml;
greens9 = Palette("GREENS", 9);
print greens9;
quit;

 

 

CXF7FCF5 CXE5F5E0 CXC7E9C0 CXA1D99B CX74C476 CX41AB5D CX238B45 CX006D2C CX00441B

View solution in original post

3 REPLIES 3
ballardw
Super User

If you go to this link you will find that SAS supports multiple ways to define colors: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/graphref/p0edl20cvxxmm9n1i9ht3n21eict.htm

 

If you don't want to learn one of the numeric coding systems like RGB, CMYK I suggest that you look at the page for "Color Naming System" or CNS. That uses more modifiers for color where you combine the elements of Lightness, Saturation and Hue from the following table.

So you could have

Verydarkgreen

Verydarkgrayishgreen

Verydarkmoderategreen

Verydarkstronggreen

Verydarkvividgreen

(replace VeryDark with Dark, Medium,Light or verylight)

This system also allows combine colors that are adjacent (green is adjacent to blue) so you can use

BlueGreen, GreenBlue, YellowGreen, GreenYellow. Or to have one of the colors contribute a bit less add "ish"

YellowishGreen, GreenishYellow.

Along with the other lightness and saturation options.

So you can have MediumModerateYellowishGreen for example.

BLACK and WHITE will be that regardless of other elements.

 

 

 

Lightness
Saturation
Hue
Black
Gray
Blue
Very Dark
Grayish
Purple
Dark
Moderate
Red
Medium
Strong
Orange/Brown
Light
Vivid
Yellow
Very Light
 
Green
White
Ksharp
Super User

You can use function Palette() in IML.

proc iml;
greens9 = Palette("GREENS", 9);
print greens9;
quit;

 

 

CXF7FCF5 CXE5F5E0 CXC7E9C0 CXA1D99B CX74C476 CX41AB5D CX238B45 CX006D2C CX00441B
Rick_SAS
SAS Super FREQ

For a discussion of SAS color-naming schemes (with examples) see "Three ways to specify colors in SAS statistical graphics procedures,"

 

Here's an example of how to specify different shades of greens on the STYLEATTRS statement:

proc sgplot data=sashelp.cars;
styleattrs datacolors=('Light Brownish Green' 'DarkOliveGreen' 'SeaGreen');
vbar Cylinders / group=origin;
run;

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