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;
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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.