SAS Programming

DATA Step, Macro, Functions and more
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.

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1220 views
  • 2 likes
  • 4 in conversation