BookmarkSubscribeRSS Feed
DavidBesaev
Fluorite | Level 6

Hello, everyone!

I need to find the maximum and minimum values in the lines and highlight them in different colors, how is this best done?

I can not compare two columns in compute function.

proc report data=work.newtemp nowd;
columns total maxtotal Mintotal meantotal min1;

define total / order format=nlnum10.;

compute total;
if total = min1 then call define (_col_,'style','style={foreground=green font_weight=bold font_size=14pt}');
endcomp;
quit;

Obs TOTAL mintotal maxtotal meantotal min1
27046590784216937.716937.71
36071590784216937.716071.00
45907590784216937.715907.00
57094590784216937.716937.71
67910590784216937.716937.71
76115590784216937.716115.00

 

4 REPLIES 4
RM6
Obsidian | Level 7 RM6
Obsidian | Level 7
Hi,

instead of using _col_ to define the color, use _row_ which will color specific cell rather than the whole column
DavidBesaev
Fluorite | Level 6
Hi, thx for your answer!

It doesn't change color anywhere, if i write:
compute total;
if total = 5907 then call define (_row_,'style','style={foreground=green font_weight=bold font_size=14pt}');
endcomp;
it works, but if I want to compare the columns, nothing happens.
How do I compare the values of the columns line by line in compute step?
Thank you!
Ksharp
Super User

compute total;

 

--->

compute min1;

if total = min1 then call define ('total','

DavidBesaev
Fluorite | Level 6
It works, if "min1" will be before "total" and add define for min1 as display! Thank you!

proc report data=work.norper nowd;
columns min1 total maxtotal Mintotal meantotal ;
define total / display format=nlnum10.;
define min1 / display format=nlnum10.;
compute total;
if total=min1 then call define (_col_,'style','style={foreground=green font_weight=bold font_size=14pt}');
endcomp;
quit;

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

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 2221 views
  • 1 like
  • 3 in conversation