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

 

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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!

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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 😉

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

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!

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.

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