BookmarkSubscribeRSS Feed
HitmonTran
Pyrite | Level 9

Hi,

I need the total sum for each column displayed at the very bottom

data:
site col1 col2 col3
A 2 3 6
B 2 4 7
C 2 5 8


want:
site col1 col2 col3
A 2 3 6
B 2 4 7
C 2 5 8
Total 6 12 21
4 REPLIES 4
Tom
Super User Tom
Super User
proc print data=have ;
  var site col1-col3;
  sum col1-col3 ;
run;
PeterClemmensen
Tourmaline | Level 20

Do you want this in a report or in a SAS data set?

HitmonTran
Pyrite | Level 9
I want this in a rtf report
tarheel13
Rhodochrosite | Level 12

I think this does what you need. https://communities.sas.com/t5/SAS-Programming/Proc-Report-Grand-Total/td-p/538641 

 ods rtf file="filepath";

/*proc report code goes here*/

ods rtf close;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 4 replies
  • 1145 views
  • 0 likes
  • 4 in conversation