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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.