## How to traffic light individual cells in PROC report based on _C?_ and _R?_ criteria

Solved
Occasional Contributor
Posts: 8

# How to traffic light individual cells in PROC report based on _C?_ and _R?_ criteria

Dear All,

I am new to proc report and am trying to create a report which would have means of variables going across columns,
and then "traffic lighted" based on variables that contains p-values to assess whether they are statistically significant. In this
regards, I have been able to do this.

However, I have a 'twist' in that I want that if one cell in one row is greater than another cell in another row and the p-value is significant
I want a certain color, but if that same cell in that same row is less than another cell in another row and the p-value is significant
I want a different color.

So for example, if a p-value is statistically significant and the mean for a variable representing female is greater than a mean for a variable representing male I want the color red, but if male is greater than female I want the color blue.  In essence, what I think I am asking is I know that individual columns can be referred to as _c1_, _c2_, _c3_ etc..., but can individual rows be referred to as _r1_, _r2_, etc. instead of just _row_. Then I could use logical conditions to refer to say column 6, _c6_, and row 4, _r4_, and column 6, and row 5, for instance.  It seems like all I have found online is _row_, but I could be mistaken.

Below is coding that successfuly does the traffic lighting based based on p-values, but not with the 'twist'.

Thank you for any help you are willing to offer and let me know if I can clarify anything. Also I am using SAS 9.4 for Windows.

Sincerely,

Craig Ziegler

Accepted Solutions
Solution
2 weeks ago
Occasional Contributor
Posts: 8

## Re: How to traffic light individual cells in PROC report based on _C?_ and _R?_ criteria

BallardW,

Thank you for your helpful suggestion.  I've been playing around with the datastep/lag function and should be able to get what I need.

Sincerely,

Craig

All Replies
Super User
Posts: 13,931

## Re: How to traffic light individual cells in PROC report based on _C?_ and _R?_ criteria

There really isn't a reason to attach SAS code. Paste it from your editor into a code box opened on the forum using the {I} icon.

Because Proc report builds columns left to right you would have to have the calculation and comparisons done before any of the highlighted columns appear in the report output. If your data is not already summarized before going into proc report you might consider that so that all of the values needed are already available. Then possibly create additional variable to hold values that can be referenced.

Solution
2 weeks ago
Occasional Contributor
Posts: 8

## Re: How to traffic light individual cells in PROC report based on _C?_ and _R?_ criteria

BallardW,

Thank you for your helpful suggestion.  I've been playing around with the datastep/lag function and should be able to get what I need.

Sincerely,

Craig

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
• 2 replies
• 114 views
• 0 likes
• 2 in conversation