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. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 932 views
  • 0 likes
  • 2 in conversation