BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
hhchenfx
Rhodochrosite | Level 12

proc report data=sashelp.class nowd;
*Color whole column;
	compute age;
	call define(_col_,"style","style={background=gray}");
	endcomp;
*color rule 1; define Height/display; compute Height; if Height<60 then call define(_col_,"style","style={background=red}"); endcomp; *color rule 2; define Weight/display; compute Weight; if Weight<100 then call define(_col_,"style","style={background=Yellow}"); endcomp; run;

*Color the whole row;
proc report data=sashelp.class nowd ;
define Age/display;
compute Age;
if Age > 15 then call define(_row_,"style","style={background=Red}");
endcomp;
run;
1 ACCEPTED SOLUTION
2 REPLIES 2
hhchenfx
Rhodochrosite | Level 12
data have;
input n a b;
datalines;
1 2 .
2 3 1
3 0 1
4 -2 .
5 4 -1
;run;
proc report data=have nowd;
column n a b ;
    define n/display;
	define a/display;
	define b/display;
	
    compute  b;	/*if you need to check a condition, COMPUTE the last column to the right*/
		if a>0  and b=1 then do;		
    do i = 2 to 3;	/*column to color*/
	call define(i, "style","style={background=light greenish yellow}");
	end;
	end;				
	endcomp;
run;

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1415 views
  • 1 like
  • 1 in conversation