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;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1504 views
  • 1 like
  • 3 in conversation