BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
WendyT
Pyrite | Level 9

Hi SAS folks-

 

Small issue... was doing a quick proc print, used sum to get a grand total, then couldn't figure out how to label it.  Anyone know why grandtotal_label is not working here?  (Yes, I could do it in another proc, but got interested.)

 

Thanks!

 

Wendy

 

proc print data=sashelp.shoes label noobs grandtotal_label='Total Sales';
id region ;
sum sales ;
where product='Boot' and region like 'A%' ;
run ;

1 ACCEPTED SOLUTION

Accepted Solutions
ed_sas_member
Meteorite | Level 14

Hi @WendyT 
the grand total label is actually displayed in the ‘obs’ column.

To see it, you need to remove the NOOBS option as well as the ID statement.

Best,

proc print data=sashelp.shoes label /*noobs*/ grandtotal_label='Total Sales';
*id region ;
sum sales ;
where product='Boot' and region like 'A%' ;
run ;

View solution in original post

6 REPLIES 6
WendyT
Pyrite | Level 9
I'm running SAS 9.4M5 on Windows with a remote login, if that makes any difference.
ed_sas_member
Meteorite | Level 14

Hi @WendyT 
the grand total label is actually displayed in the ‘obs’ column.

To see it, you need to remove the NOOBS option as well as the ID statement.

Best,

proc print data=sashelp.shoes label /*noobs*/ grandtotal_label='Total Sales';
*id region ;
sum sales ;
where product='Boot' and region like 'A%' ;
run ;
ChrisHemedinger
Community Manager

I think SUMLABEL and GRANDTOTAL_LABEL kick in only when there is a BY group.  That's how those options are documented.

 

proc print data=sashelp.shoes 
  label noobs sumlabel='Region Sales' 
  grandtotal_label="TOTAL Sales";
by region ;
sum sales ;
where product='Boot' and region like 'A%' ;
run ;

ChrisHemedinger_0-1591719896815.png

 

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!
ChrisHemedinger
Community Manager

@ed_sas_member is correct.  And...so am I, sort of, with the BY group note.  So...take your pick of which approach suits you!

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!
Reeza
Super User
Chris, what makes you think that it's only effective on a BY statement. It definitely seems to be valid only with a BY statement but I don't see anything in the documentation that actually explicitly states this is a limit though I'm likely missing it.
ChrisHemedinger
Community Manager

Hi @Reeza - as @ed_sas_member points out, you can use it without BY when the OBS column is displayed.  With BY and the SUMLABEL, there's a "Sum" spot allocated so I guess it just renders there.  This is probably a function of the ODS template for this in PROC PRINT.

 

As far as how I read the doc...well, you're right.  It doesn't say a BY is needed.  I was just thinking like a PROC.  "SUMLABEL" is doc'd as needing a BY to display group totals, and a "grand total" is a total of totals...so I just assumed a BY was needed for that too.  But I guess not, though it seems to help in some cases 😉

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!

SAS Innovate 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 6 replies
  • 2400 views
  • 2 likes
  • 4 in conversation