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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2554 views
  • 0 likes
  • 3 in conversation