BookmarkSubscribeRSS Feed
analyst_work
Obsidian | Level 7

Hi, 

I am trying to add traffic lighting to my data set using proc report. I have the data in a wide format, I want to flag all values (could be changing the font color or the background cell color) which are 2 std dev away from the mean for that particular row. So essentially, I am comparing the mean to each of the column (almost 60 columns in total) Here's how I would like my data to look like (of course the mean/std values for different rows will be different, this is just an example):

 

Hospital  Dec_2019 Jan_2020 Feb_2020 March_2020   Mean    Std_Dev

A                   20              25           30                65             35         20.41

B                  20              65            30                65             35         20.41  

C                  65              25            30               20             35         20.41

D                  20              25            65                65             35         20.41

 

Thanks for your help!

3 REPLIES 3
Patrick
Opal | Level 21

A Google search using keywords sas proc report style based on another column value returned quite a few relevant links for me.

 

Have a look if the solution @Cynthia_sas proposes here gives you what you need.

 

If you're after actual code then please post working Proc Report code together with the data used so that we just can add the desired traffic lighting bit (and we also need the data so we can test what we propose).

 

Cynthia_sas
SAS Super FREQ
Hi:
Thanks @Patrick for the reference!

The hitch in the description of what's needed is that you can't add traffic-lighting to the data set, but CAN add traffic-lighting as described to an HTML, PDF or RTF report. There are 2 ways to do it in PROC REPORT: simple style override or CALL DEFINE statement. How the OP needs to do it will depend on what is in the COLUMN statement.

Are there individual variables for each month or is there an Across variable being used? That matters because it will change how the PROC REPORT code is written.

So @Patrick's suggestion is on point. Without the PROC REPORT code and data that produces the report without color-coding, its hard to make specific suggestions.

Cynthia
analyst_work
Obsidian | Level 7
Thanks for the suggestions. Each month is a separate variable. So I would need to assess if each variable is 2 std dev away from the mean and then highlight the ones which are out of that range.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 801 views
  • 1 like
  • 3 in conversation