BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
pax
Calcite | Level 5 pax
Calcite | Level 5
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;
1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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.

 

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;


cynthia

View solution in original post

1 REPLY 1
Cynthia_sas
SAS Super FREQ

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.

 

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;


cynthia

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 1 reply
  • 4744 views
  • 0 likes
  • 2 in conversation