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;

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
  • 1936 views
  • 0 likes
  • 4 in conversation