I've been working on a solution to subtracing duplicate credits from a ledger. Is anyone able to lend a hand on this? Sample data below:
TRAN_CD | TRAN_AMT | DEBIT_CREDIT_INDICATOR | new_key |
776 | 40.00 | C | 109560357322350000000.00 |
776 | 40.00 | C | 109560357322350000000.00 |
776 | 40.00 | C | 109560357322350000000.00 |
776 | 40.00 | C | 109560357322351000000.00 |
353 | 15000.00 | D | 109560345122351000000000.00 |
753 | 15000.00 | C | 109560345122351000000000.00 |
753 | 15000.00 | C | 109560345122351000000000.00 |
776 | 29.00 | C | 1095603451223510000000.00 |
776 | 40.00 | C | 1095603451223510000000.00 |
776 | 40.00 | C | 1095603451223510000000.00 |
In the case of the $15000 transaction that occurred three times, I would want to basically negate the debit and one of the credits to show a net $15000 transaction, not $45000 worth of transactions. I concatenated a few feilds within the data to create a unique key that you see in the far right column. Very stuck. Any help is appreciated!
@hoaglam wrote:
I've been working on a solution to subtracing duplicate credits from a ledger. Is anyone able to lend a hand on this? Sample data below:
TRAN_CD TRAN_AMT DEBIT_CREDIT_INDICATOR new_key 776 40.00 C 109560357322350000000.00 776 40.00 C 109560357322350000000.00 776 40.00 C 109560357322350000000.00 776 40.00 C 109560357322351000000.00 353 15000.00 D 109560345122351000000000.00 753 15000.00 C 109560345122351000000000.00 753 15000.00 C 109560345122351000000000.00 776 29.00 C 1095603451223510000000.00 776 40.00 C 1095603451223510000000.00 776 40.00 C 1095603451223510000000.00
In the case of the $15000 transaction that occurred three times, I would want to basically negate the debit and one of the credits to show a net $15000 transaction, not $45000 worth of transactions. I concatenated a few feilds within the data to create a unique key that you see in the far right column. Very stuck. Any help is appreciated!
And just how are we to tell which are duplicates?
From what you are showing so far I would not even know that debit you reference is in any way related to the credit value.
I would guess that there is more identification information that you are not providing that is very likely going to be important for actually having a chance to program a solution.
Hi there. In the data I'm showing the duplicates I'm trying to remove are in rows 5, 6 and 7. In reality, we have a net $15,000 transaction. All three of these keys share the same "new_key" identifier, which is how I'm identifying duplicates. Hopefully thats helpful. Thanks again!
@hoaglam wrote:
Hi there. In the data I'm showing the duplicates I'm trying to remove are in rows 5, 6 and 7. In reality, we have a net $15,000 transaction. All three of these keys share the same "new_key" identifier, which is how I'm identifying duplicates. Hopefully thats helpful. Thanks again!
You have three 109560357322350000000.00 for the "new_key" in the first three records. Why are they not "duplicates"? Same with 1095603451223510000000.00 for the last three. Why are they not duplicates.
I think that your problem description is a bit incomplete or you have multiple meanings for "duplicate".
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.