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;
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:
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.