The SAS Output Delivery System and reporting techniques

Conditional format to rows with PROC PRINT or REPORT

Reply
pax
N/A
Posts: 1

Conditional format to rows with PROC PRINT or REPORT

Is there an easy way conditionally to put a different format to the rows in output from PRINT or REPORT.
I.e. I would like to print all the rows where sex='F' with bold font and red background:

ods html style=sasweb;
proc print data=sashelp.class;
id name;
run;
ods html close;
SAS Super FREQ
Posts: 8,864

Re: Conditional format to rows with PROC PRINT or REPORT

Hi:
PROC PRINT allow you to perform traffic lighting on particular cells, while PROC REPORT allows you to perform row level conditional highlighting using the CALL DEFINE statement.

Some sample code is below.

cynthia
[pre]
ods html file='style_rept.html' style=sasweb;
proc report data=sashelp.class nowd;
title 'Conditional Row Highlighting';
column name sex age height;
define name / order;
define sex / display;
define age /display;
define height /display;
compute sex;
if sex = 'F' then do;
call define(_ROW_,'style','style={background=red font_weight=bold}');
end;
endcomp;
run;
ods html close;
[/pre]
Ask a Question
Discussion stats
  • 1 reply
  • 708 views
  • 0 likes
  • 2 in conversation