BookmarkSubscribeRSS Feed
ss171
Calcite | Level 5
proc print data=sashelp.class
noobs round GTOTAL_LABEL="TOTAL" style(header)={backgroundcolor=cyan color=black fontsize=2 fontweight=bold just=center} 
style(header data)={bordertopwidth=.5 borderbottomwidth=.5
borderleftwidth=.5 borderrightwidth=.5 borderstyle=solid bordercolor=black};
sum height age /STYLE(GRANDTOTAL)={backgroundcolor=cyan color=black fontsize=2};
var name;
var age height ;
run;

 I am not getting Total to be wriiten in Output. Can anybody help me with proc print GTOTAL_LABEL options available in proc print .

Capture.PNG

5 REPLIES 5
PaigeMiller
Diamond | Level 26

Works with a BY statement. Otherwise, without a BY statement in PROC PRINT, no GRANDTOTAL is printed, only a SUM is printed (and you can use SUMLABEL=' ').

--
Paige Miller
ss171
Calcite | Level 5

With sumlabel as well I am not getting Total . Is SUMLABEL also works with BY only ?

andreas_lds
Jade | Level 19

From the docs:

SUMLABEL='label'

specifies the text to use as a label on the summary line of a BY group. You can include the #BYVAR and #BYVAL variables in 'label'.

Reeza
Super User
Yes, SUMLABEL only works with a BY statement. You can add a fake BY statement and use just the GRANDTOTAL option instead of subtotals if that will work. Again, wrong tool for what you're trying to do.
Reeza
Super User
Use the right tool for the right job, AKA it would be easier with REPORT or TABULATE.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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