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;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

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
  • 4 replies
  • 1361 views
  • 1 like
  • 3 in conversation