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
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.
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.
This is great.
Thank you for this:smileycool:
Stret
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.