BookmarkSubscribeRSS Feed
BillB
Fluorite | Level 6

I have a data subset with acct numbers and curency amounts. There are multiple acct numbers with different currency values.

I want to obtain a subset of the acct numbers (Unique numbers) with their currency values summed e.g.

Example:

Here is what I have

Acct Number     Value

1111                    $10

1111                    $5

1111                    $20

2222                    $5

2222                    $15

Here is what I want

Acct Number     Value

1111                    $35

2222                    $20

Total                    $55

I want to be able to do this without programming since I'm still a "Novice" user.

3 REPLIES 3
ballardw
Super User

If the data is in a SAS data set named have, assuming the acct number variable name is account:

proc means data=have sum nway;

     class account;

     var value;

/* if you want to redirect the output to another data set add this line*/

     output out=newdataset  /sum=;

run;

BillB
Fluorite | Level 6

I'm still new to E.G. and was hoping to get a non-programming solution.

TomKari
Onyx | Level 15

Believe it or not, you can get exactly that code using the EG visual tools.

Use the Describe | Summary Statistics task.

Put the variable for "Acct Number" into Classification Variables, and the variable for "Value" into Analysis Variables.

On the Statistics | Basic tab, click Sum, and unclick the others.

On Results, you have a few choices. Try playing around with "Show Statistics", which will create the output in a report format, and "Save statistics to a data set", which will do exactly that. Also, if you pick "N-way only", you'll only get summarization by Acct Number; if you pick "All ways", you'll also get a grand total.

Give it a try, and check out the help topics.

  Tom

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 3 replies
  • 2291 views
  • 0 likes
  • 3 in conversation