I am new to SAS and trying to solve the following scenario:
Scenario: A loan (123) has more than 2 transactions on a given transaction date. And, each record has a columns: ID, Trans_Amt, LoanNo, etc.
I was asked to create a column to show if two different records with same loan# and ID adds up to 0 for Trans_Amt then those two records should be shown as 'Y'
data have;
input ID$ Loan_No Trans_Am;
datalines;
A1 123 -10
B1 123 20
A1 123 10
A1 123 20
;
run;
Output should be:
data want;
input ID$ Loan_No Trans_Am Exception$;
datalines;
A1 123 -10 Y
B1 123 20 N
A1 123 10 Y
A1 123 20 N
;
run;
Thanks in advance for your help
My thought process is to create loops for ID, LoanNo and iterate through them but unsure as to how to do it in SAS.