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
Hi:
With PROC TABULATE, you can use a format to do some highlighting, such as shown below:
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:
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.