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.
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;
I'm still new to E.G. and was hoping to get a non-programming solution.
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
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.