BookmarkSubscribeRSS Feed
axavi1
Calcite | Level 5

Accounts table has 4 records entered in July 2016.

Accounts  
IDEntry dateOrignal_Debt
A10015/7/16$20
A10122/7/16$25
A10225/7/16$10
A10328/7/16$5

 

Payment table

Paid  
IDPaid datePaid
A10017/7/16$22
A10017/7/16-$22
A10019/7/16$20
A1014/8/16$30
A10231/7/16$2
A1021/8/16$2
A1022/8/16$2
A1023/8/16$2
A1024/8/16$2
A1025/8/16$2
A1031/9/16$5
A1032/9/16$10
A1032/9/16-$10

 

Final Output:

Output      
    Paid Month Paid Month Paid Month 
Month-YearAccounts EnteredOriginal DebtJul-16Aug-16Sep-16Total Paid
Jul-164$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.

 

4 REPLIES 4
Norman21
Lapis Lazuli | Level 10
What code have you written? Where do you need help?
Norman.
SAS 9.4 (TS1M6) X64_10PRO WIN 10.0.17763 Workstation

axavi1
Calcite | Level 5

Hi Norman,

 

I want the accounts and payment table summarized into below table.

Month-YearAccounts EnteredOriginal DebtJul-16Aug-16Sep-16Total Paid
Jul-164$60$22$33$5$60

 

Jul-16, Aug-16 and Sep-16 are paid months. 

LinusH
Tourmaline | Level 20
@axavi1, what I think @Norman21 is trying to hint is that this is not a programming service. That said, we're usually glad to help on more specific issues, not solving an entire a task from scratch.

Simply put, join your tables on ID, and then use a report procedure to the layout wanted. Like PROC TABULATE.
Data never sleeps
Reeza
Super User

You haven't clearly specified how you determine which record to exclude in the case of overpayment. 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

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
  • 4 replies
  • 858 views
  • 0 likes
  • 4 in conversation