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
Diamond | Level 26

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1553 views
  • 0 likes
  • 2 in conversation