BookmarkSubscribeRSS Feed
cbarks
Calcite | Level 5

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;

1 REPLY 1
SuzanneDorinski
Lapis Lazuli | Level 10

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. 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1429 views
  • 0 likes
  • 2 in conversation