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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1250 views
  • 0 likes
  • 2 in conversation