SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Stalk
Pyrite | Level 9

I' m using the following colors but they are too bright. Are there any other mild shades for red, green and yellow to show on the report?

if diff_pct gt .9 then call define(_row_,'style','style=[background=lightgreen]');
if .6 le diff_pct le .9 then call define(_row_,'style','style=[background=yellow]');
else if diff_pct lt .6 then call define(_row_,'style','style=[background=lightred]');
 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
You can specify any colour you'd like, I usually use colorbrewer to get my colour schemes.
https://colorbrewer2.org/#type=sequential&scheme=BuGn&n=3

You specify your colours with the hex code as follows:

background = CXe5f5f9 for a pale light green for example.

https://blogs.sas.com/content/iml/2012/10/22/whats-in-a-name.html

View solution in original post

2 REPLIES 2
Reeza
Super User
You can specify any colour you'd like, I usually use colorbrewer to get my colour schemes.
https://colorbrewer2.org/#type=sequential&scheme=BuGn&n=3

You specify your colours with the hex code as follows:

background = CXe5f5f9 for a pale light green for example.

https://blogs.sas.com/content/iml/2012/10/22/whats-in-a-name.html
ballardw
Super User

SAS supports several color naming conventions.

If you want one that is human understandable use

Color Naming System which uses these keywords

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

 

You combine the keywords (except BLACK and WHITE, regardless of modifiers you get the same color)

You can write color names in the following ways:
  • without space separators between words
  • with an underscore to separate words
  • with a space to separate words, enclosed in quotation marks
For example, all the following are valid color specifications:
  • verylightmoderatepurplishblue
  • very_light_moderate_purplish_blue
  • "very light moderate purplish blue"

 Notice the use of "ish" with one hue value to modify another. Some won't make a lot of sense like "bluish_blue" but are not syntactically incorrect.

 

Experiment and have fun.

Or learn the CMYK, RGB, HSV, HLS and similar numeric codes. If you don't use these often when you see something like "cx123123" you may not remember what that means.

 

There are also the "standard" color names. You should be able to get a list of them running this code:

proc registry list
 startat="COLORNAMES";
run;

The log will show the color name followed by hex code values for the colors using RGB coding.

You can modify the registry list to include your list of names but unless you have an overriding need to use "BillsFavBlue" it may be more work to keep track of the code for when an update is needed than is worth it.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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