Accounts table has 4 records entered in July 2016.
Accounts | ||
ID | Entry date | Orignal_Debt |
A100 | 15/7/16 | $20 |
A101 | 22/7/16 | $25 |
A102 | 25/7/16 | $10 |
A103 | 28/7/16 | $5 |
Payment table
Paid | ||
ID | Paid date | Paid |
A100 | 17/7/16 | $22 |
A100 | 17/7/16 | -$22 |
A100 | 19/7/16 | $20 |
A101 | 4/8/16 | $30 |
A102 | 31/7/16 | $2 |
A102 | 1/8/16 | $2 |
A102 | 2/8/16 | $2 |
A102 | 3/8/16 | $2 |
A102 | 4/8/16 | $2 |
A102 | 5/8/16 | $2 |
A103 | 1/9/16 | $5 |
A103 | 2/9/16 | $10 |
A103 | 2/9/16 | -$10 |
Final Output:
Output | ||||||
Paid Month | Paid Month | Paid Month | ||||
Month-Year | Accounts Entered | Original Debt | Jul-16 | Aug-16 | Sep-16 | Total Paid |
Jul-16 | 4 | $60 | $22 | $33 | $5 | $60 |
Some points to be noted:
1. From the payments table, we can see that A101 has paid 5$ extra that does not need to be considered.
2. A102 has done payment in installments but mistakenly paid 2$ extra that does not need to be considered.
3. For ID A100 and A103, there were some records that were mistakenly recorded that has to be avoided (reversal of values).
Any help would be appreciated.
Hi Norman,
I want the accounts and payment table summarized into below table.
Month-Year | Accounts Entered | Original Debt | Jul-16 | Aug-16 | Sep-16 | Total Paid |
Jul-16 | 4 | $60 | $22 | $33 | $5 | $60 |
Jul-16, Aug-16 and Sep-16 are paid months.
You haven't clearly specified how you determine which record to exclude in the case of overpayment.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.