Hi all,
I have a sample data set and I want to sum the current_balance of same icustomerid. For e.g. if there are two debt_codes with one icustomerid then I would like to see one icustomerid with the total current_balance. I am trying to find the total balance for each icustomerid. Here is the sample dataset.
Data Test;
infile cards expandtabs;
input rep_code $ debt_code client_code $ Current_balance Balance_banding $ icustomerid;
datalines ;
168 245442736 3G073 47.57 £40-50 490
168 284369295 SUL007 7.79 £0-10 490
122 379059801 CAPONE150 276.21 £50+ 1234
122 379021629 CAPONE150 625.88 £50+ 1234
122 401458237 VANQUIS199 2862.77 £50+ 1234
122 396978322 EON067 252.35 £50+ 1234
168 441317245 SHOPDRCT1063 271.29 £50+ 125
;
run;
Can you please suggest the correct way?
This is a job for PROC SUMMARY!
proc summary data=test nway;
class icustomerid;
var current_balance;
output out=want sum=;
run;
This is a job for PROC SUMMARY!
proc summary data=test nway;
class icustomerid;
var current_balance;
output out=want sum=;
run;
@Sandeep77 wrote:
Just wanted to add in it that what can I do if I want to add all the columns from the previous table to this test table? For e.g. we use select * to get all the variables from the previous dataset.
I don't know what you mean. Please explain further. Provide data examples and desired output.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.
Find more tutorials on the SAS Users YouTube channel.