DATA Step, Macro, Functions and more

Adding space between before break and rbreak

Reply
New Contributor
Posts: 3

Adding space between before break and rbreak

Hi,

 

I am trying to add a space between the attached Grand Total and subtotal but having difficulty figuring out how to code. 

Any suggestions will be greatly appreciated.

 

Thanks

 

break before Groupm / ol summarize skip;

break after Groupm / page;

rbreak before / summarize skip;

compute Service_Category;

if _break_='_RBREAK_' then do;

Service_Category='Grand Total';

call define(_row_, 'style', 'style=[font_weight=bold color = white background = grey]');

end;

else if upcase(_break_)="GROUPM" then do;

Service_Category=Groupm;

call define(_row_, 'style', 'style=[font_weight=bold color = white background = grey]');

end;

else Service_Category = ' ' || Service_Category;

endcomp;

compute after Service_Category;

if _break_='_RBREAK_' then do;

Line=' ';

call define(_row_, 'style', 'style=[font_weight=black color = white background = black]');

end;

endcomp;

Contributor
Posts: 65

Re: Adding space between before break and rbreak

The skip option works only in ODS LISTING.  

 

If you want a blank line between the grand total and the first subtotal row, it could be as simple as 

 

    compute before;
      line ' ';
    endcomp;

Example code, modified from code in Cynthia Zender's SAS Global Forum 2017 paper, available at http://support.sas.com/resources/papers/proceedings17/SAS0431-2017.pdf:

 

data shoes;
  length Product $ 31;
  set sashelp.shoes;
run;

proc report data=shoes spanrows style(summary)=Header;
	column region product sales returns Profit inventory PctInv;
	define region / group noprint;
	define product / group;
	define profit / computed f=dollar14.;
	define pctinv / computed f=percent9.2;
	*** column and define statements same as previous code ***;
	*** compute block for pctinv same as previous code ***;
	break before region/summarize;
	rbreak before / summarize;
	compute pctinv;
		profit=sum(sales.sum, -1*returns.sum);
		pctinv=sales.sum / inventory.sum;
	endcomp;
	compute product;
 	  if upcase(_break_)='REGION' then
		  product=catx(' ', region, 'Total');
	  else if _break_='_RBREAK_' then 
		   product='Grand Total';
    endcomp;
    compute before;
      line ' ';
    endcomp;
run;

Part of the output from the example code:

 

PROC REPORT with blank line between grand total row and subtotal row.jpg

 

Jane Eslinger's SAS Global Forum 2015 paper, available at https://support.sas.com/resources/papers/proceedings15/SAS1642-2015.pdf, discusses adding blank rows, starting on page 11. 

Ask a Question
Discussion stats
  • 1 reply
  • 148 views
  • 0 likes
  • 2 in conversation