The SAS Output Delivery System and reporting techniques

How to get color coding in SAS?

Reply
Contributor
Posts: 26

How to get color coding in SAS?

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

Valued Guide
Posts: 3,206

Re: How to get color coding in SAS?

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 --<-----
Contributor
Posts: 38

Re: How to get color coding in SAS?

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

Super Contributor
Posts: 291

Re: How to get color coding in SAS?

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;

Post a Question
Discussion Stats
  • 3 replies
  • 402 views
  • 0 likes
  • 4 in conversation