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-2024.png

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.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1074 views
  • 2 likes
  • 2 in conversation