The SAS Output Delivery System and reporting techniques

Remove duplicate labels when using break before in PROC REPORT

Accepted Solution Solved
Reply
Contributor
Posts: 42
Accepted Solution

Remove duplicate labels when using break before in PROC REPORT

Hi there,

 

I'm using a PROC REPORT to create a table on which I would like to apply a style on certain lines to highlight the change of group (visit in this case). I have found that a break after the visit variable generates exaclty the effect that I'm looking for, but the label of the visit appears now duplicated (in the grey background line, which is the one that I would like to keep, and on the white background line, which I would like to remove). Is there any easy way to avoid this duplicity?

 

The code of the PROC REPORT is part of a macro:

 

 

proc report data=data2report2 nowindows headline style(header)={background=very light grey} missing split='*';
	column("&title." &timevar. ('Shift' shift) &stratavar., nval);
	define &stratavar./ '' across nozero order=internal;
	define &timevar./ f=&timevarfmt. '' group order=internal; 
	define shift/ f=shiftfmt. '' group order=internal;
	define nval/ '' group;
	break before &timevar. / summarize style=[background=very light grey];

	compute &timevar.;
		if &timevar. eq '99999' then do;
			call define (_row_,'style', 'style=[font_weight=bold]');
		end;
	endcomp;
run;

 

 

And here is the table that I get where you can see the duplicates:

 

tablebreak.png

 

Thank you for your help!!

 

Best regards


Accepted Solutions
Solution
‎11-03-2017 12:34 PM
Super User
Posts: 10,194

Re: Remove duplicate labels when using break before in PROC REPORT

proc report ...... out=temp  /*Check the _BREAK_ variable in TEMP table*/

......

compute nval;

 if missing(_break_) then &timevar='  ';

endcomp;

View solution in original post


All Replies
Solution
‎11-03-2017 12:34 PM
Super User
Posts: 10,194

Re: Remove duplicate labels when using break before in PROC REPORT

proc report ...... out=temp  /*Check the _BREAK_ variable in TEMP table*/

......

compute nval;

 if missing(_break_) then &timevar='  ';

endcomp;

Contributor
Posts: 42

Re: Remove duplicate labels when using break before in PROC REPORT

Thank you for your quick response!!

 

I just wanted to add to your solution that if your &timevar variable is numeric you must add . = ' ' in the predefined format to avoid a point to appear in your final proc report.

 

Thanks again!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 173 views
  • 0 likes
  • 2 in conversation