BookmarkSubscribeRSS Feed
sravanpathu
Calcite | Level 5

Hi Everyone,

          I am trying to prepare a report in PDF where in one matrix in need to apply color coding based on value. Which we can do in Excel conditional formatting 3-color scale based on percentile.  Is it possible to do color coding in SAS.

Regards,

Sravan

3 REPLIES 3
jakarman
Barite | Level 11

3 colors..... that is trafficlights. like:

http://www2.sas.com/proceedings/sugi31/142-31.pdf

http://support.sas.com/resources/papers/proceedings12/282-2012.pdf

Use that searchword at the SAS support site together with ODS and conditional markup

Bi dashbord has the whole focus on that kind of presentation of data

SAS(R) BI Dashboard 4.4: User's Guide  .

---->-- ja karman --<-----
gra_in_aus
Quartz | Level 8

To display the Hex colours in SAS Log use:

proc registry list startat="colornames";

run;

You can use the code below as an example and build from it...

/* view pdf file : http://www.okstate.edu/sas/v8/saspdf/gref/c07.pdf

   for colour palette */

title;

ODS rtf file='empdata.rtf' STYLE=sasweb;

proc report data=sasuser.empdata nowd out=work.test ;

  column Division Location Salary;

  define Division / group 'Division';

  define Location / group 'Location';

  define Salary / analysis mean 'Average Salary' format=dollar8.;

  compute Salary;

    if Salary.mean <= 30000 then /* Sets Low Risk (Green) */

       CALL DEFINE(_COL_,"STYLE",

            "STYLE=[BACKGROUND=cx00cc33 FONT_WEIGHT=Bold]");

    else if Salary.mean >= 65000 then /* Sets High Risk (Red) */

       CALL DEFINE(_COL_,"STYLE",

            "STYLE=[BACKGROUND=cxFF3300 FONT_WEIGHT=Bold]");

    else

       CALL DEFINE(_COL_,"STYLE", /* Sets Medium Risk (Yellow) */

            "STYLE=[BACKGROUND=CXE5C76B FONT_WEIGHT=Bold]");

  endcomp;

run;

ODS rtf CLOSE;

TTFN

Graham

Bill
Quartz | Level 8

I use this method for a tabular report that I run.

proc format;

value colour

low - 5 = 'cxfef0d9'

5.01 - 10 = 'cxfdcc8a'

10.01 - high = 'cxfc8d59'

;

run;

proc tabulate;

class ...;

var ...;
table class,var*[style=[background=colour.]];

run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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