The SAS Output Delivery System and reporting techniques

Change max and min cell color in a row in proc report

Reply
Occasional Contributor
Posts: 11

Change max and min cell color in a row in proc report

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

 

Contributor RM6
Contributor
Posts: 24

Re: Change max and min cell color in a row in proc report

Posted in reply to DavidBesaev
Hi,

instead of using _col_ to define the color, use _row_ which will color specific cell rather than the whole column
Occasional Contributor
Posts: 11

Re: Change max and min cell color in a row in proc report

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!
Super User
Posts: 10,611

Re: Change max and min cell color in a row in proc report

Posted in reply to DavidBesaev

compute total;

 

--->

compute min1;

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

Occasional Contributor
Posts: 11

Re: Change max and min cell color in a row in proc report

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;
Ask a Question
Discussion stats
  • 4 replies
  • 215 views
  • 1 like
  • 3 in conversation