DATA Step, Macro, Functions and more

Need help writing code

Reply
New Contributor
Posts: 3

Need help writing code

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.

 

Frequent Contributor
Posts: 95

Re: Need help writing code

What code have you written? Where do you need help?
Norman.
SAS 9.4 (TS1M4) X64_7PRO WIN 6.1.7601 Service Pack 1 Workstation

New Contributor
Posts: 3

Re: Need help writing code

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. 

Super User
Posts: 5,429

Re: Need help writing code

@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
Super User
Posts: 19,815

Re: Need help writing code

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

Ask a Question
Discussion stats
  • 4 replies
  • 144 views
  • 0 likes
  • 4 in conversation