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

Good morning.

I have a dataset that contains about 20 variables and roughly a million observations.

One of the variables is Transaction_Amount

All I want to do is create a total value for that variable, I have tried to use proc print however the procedures takes ages and completely halts my system.

Can someone please advise me of a really simple and not resource heavy way to do this.

Thank you in advance.

Stret

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Several ways.

proc sql;

select sum(Transaction_Amount) from want;

quit;

or

proc summary data=want sum print;

var Transaction_Amount;

run;

or

data _null_;

set want end=atlast;

retain sum_ta 0;

sum_ta + Transaction_Amount;

if atlast then put sum_ta=;

run;

The last one shows the sum in the log.

Proc print will output all the data lines, which will be too much for, say, Enterprise Guide to display. And takes so long because it transfers all the data across the network.

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

Several ways.

proc sql;

select sum(Transaction_Amount) from want;

quit;

or

proc summary data=want sum print;

var Transaction_Amount;

run;

or

data _null_;

set want end=atlast;

retain sum_ta 0;

sum_ta + Transaction_Amount;

if atlast then put sum_ta=;

run;

The last one shows the sum in the log.

Proc print will output all the data lines, which will be too much for, say, Enterprise Guide to display. And takes so long because it transfers all the data across the network.

Stretlow
Obsidian | Level 7

This is great.

Thank you for this:smileycool:

Stret

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2 replies
  • 1255 views
  • 2 likes
  • 2 in conversation