BookmarkSubscribeRSS Feed
runningjay
Fluorite | Level 6

I have created a summary table of several different variables from a table and created columns to look at the number of instances occurring in each year. The table also provides a ColPctN for the two years separately (see attached).

 

I'd like to create conditional formatting based on the following:

1. If the ColPctN for a variable value is 10% or less in YEAR2 turn the cell red

2. If the ColPctN for a variable value is 10% or greater in YEAR2 turn the cell green

 

Is there a way I can use conditional formatting or something else to make this adjustment in the summary table output.

 

Thanks,

runningjay

1 REPLY 1
Cynthia_sas
SAS Super FREQ

Hi:

  With PROC TABULATE, you can use a format to do some highlighting, such as shown below:

Cynthia_sas_0-1595379152570.png

However, this format applies to both columns for COLPCTN. Not just the M column. It happened to work because I hardcoded 10.00 and 30.00 which were only found in the M column.

 

  With different values in the format, my format would impact both columns, like this:

Cynthia_sas_1-1595379335598.png

 

  The only way to JUST touch one of the cell values in the M column without impacting the F column would be to switch to PROC REPORT or possibly the Report Writing Interface. But for calculating COLPCTN, you might want to use TABULATE to generate the values and then use REPORT for the color coding. Your logic is not entirely clear to me for the color coding your want.

 

Hope this helps,

Cynthia

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1 reply
  • 1166 views
  • 0 likes
  • 2 in conversation