<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Subracting rows where duplicate values are present in a column in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735579#M38621</link>
    <description>Yes, that 353 is a transaction code that means "debit", which is also represented as a "D" in the "Debit Credit Indicator" column.</description>
    <pubDate>Tue, 20 Apr 2021 14:33:44 GMT</pubDate>
    <dc:creator>hoaglam</dc:creator>
    <dc:date>2021-04-20T14:33:44Z</dc:date>
    <item>
      <title>Subracting rows where duplicate values are present in a column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735560#M38613</link>
      <description>&lt;P&gt;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:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;TRAN_CD&lt;/TD&gt;&lt;TD&gt;TRAN_AMT&lt;/TD&gt;&lt;TD&gt;DEBIT_CREDIT_INDICATOR&lt;/TD&gt;&lt;TD&gt;new_key&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;776&lt;/TD&gt;&lt;TD&gt;40.00&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;109560357322350000000.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;776&lt;/TD&gt;&lt;TD&gt;40.00&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;109560357322350000000.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;776&lt;/TD&gt;&lt;TD&gt;40.00&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;109560357322350000000.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;776&lt;/TD&gt;&lt;TD&gt;40.00&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;109560357322351000000.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;353&lt;/TD&gt;&lt;TD&gt;15000.00&lt;/TD&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;109560345122351000000000.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;753&lt;/TD&gt;&lt;TD&gt;15000.00&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;109560345122351000000000.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;753&lt;/TD&gt;&lt;TD&gt;15000.00&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;109560345122351000000000.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;776&lt;/TD&gt;&lt;TD&gt;29.00&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;1095603451223510000000.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;776&lt;/TD&gt;&lt;TD&gt;40.00&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;1095603451223510000000.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;776&lt;/TD&gt;&lt;TD&gt;40.00&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;1095603451223510000000.00&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 14:05:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735560#M38613</guid>
      <dc:creator>hoaglam</dc:creator>
      <dc:date>2021-04-20T14:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Subracting rows where duplicate values are present in a column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735563#M38615</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/374686"&gt;@hoaglam&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;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:&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;TRAN_CD&lt;/TD&gt;
&lt;TD&gt;TRAN_AMT&lt;/TD&gt;
&lt;TD&gt;DEBIT_CREDIT_INDICATOR&lt;/TD&gt;
&lt;TD&gt;new_key&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;776&lt;/TD&gt;
&lt;TD&gt;40.00&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;109560357322350000000.00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;776&lt;/TD&gt;
&lt;TD&gt;40.00&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;109560357322350000000.00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;776&lt;/TD&gt;
&lt;TD&gt;40.00&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;109560357322350000000.00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;776&lt;/TD&gt;
&lt;TD&gt;40.00&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;109560357322351000000.00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;353&lt;/TD&gt;
&lt;TD&gt;15000.00&lt;/TD&gt;
&lt;TD&gt;D&lt;/TD&gt;
&lt;TD&gt;109560345122351000000000.00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;753&lt;/TD&gt;
&lt;TD&gt;15000.00&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;109560345122351000000000.00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;753&lt;/TD&gt;
&lt;TD&gt;15000.00&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;109560345122351000000000.00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;776&lt;/TD&gt;
&lt;TD&gt;29.00&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;1095603451223510000000.00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;776&lt;/TD&gt;
&lt;TD&gt;40.00&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;1095603451223510000000.00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;776&lt;/TD&gt;
&lt;TD&gt;40.00&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;1095603451223510000000.00&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And just how are we to tell which are duplicates?&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 14:15:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735563#M38615</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-20T14:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Subracting rows where duplicate values are present in a column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735568#M38616</link>
      <description>Mark Credits as -1 and Debits as +1 in a column called direction, and then group by your identifier columns and sum the transaction amounts multiplied by the direction. &lt;BR /&gt;You may want to flip debits/credits positive/negative to get the sign you need. Not sure which fields will uniquely identify a record since your first three look identical to me.</description>
      <pubDate>Tue, 20 Apr 2021 14:21:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735568#M38616</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-04-20T14:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Subracting rows where duplicate values are present in a column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735570#M38617</link>
      <description>&lt;P&gt;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!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 14:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735570#M38617</guid>
      <dc:creator>hoaglam</dc:creator>
      <dc:date>2021-04-20T14:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Subracting rows where duplicate values are present in a column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735572#M38618</link>
      <description>Is that a type on your 5th record then, with the TRAN_CD being 353 rather than 753?</description>
      <pubDate>Tue, 20 Apr 2021 14:27:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735572#M38618</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-04-20T14:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: Subracting rows where duplicate values are present in a column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735579#M38621</link>
      <description>Yes, that 353 is a transaction code that means "debit", which is also represented as a "D" in the "Debit Credit Indicator" column.</description>
      <pubDate>Tue, 20 Apr 2021 14:33:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735579#M38621</guid>
      <dc:creator>hoaglam</dc:creator>
      <dc:date>2021-04-20T14:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: Subracting rows where duplicate values are present in a column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735592#M38623</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/374686"&gt;@hoaglam&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;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!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;I think that your problem description is a bit incomplete or you have multiple meanings for "duplicate".&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 14:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735592#M38623</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-20T14:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Subracting rows where duplicate values are present in a column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735595#M38625</link>
      <description>Im using that unique key as a grouping only. The duplicates that I'm worried about are in the transaction values where both debits AND credits are present within the same account for the same amount. In the table I posted, the only duplicate I posted was for row 5. Row 5 should negate row 6 in this case, leaving a single transaction for that "new_key" group.</description>
      <pubDate>Tue, 20 Apr 2021 14:56:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735595#M38625</guid>
      <dc:creator>hoaglam</dc:creator>
      <dc:date>2021-04-20T14:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Subracting rows where duplicate values are present in a column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735596#M38626</link>
      <description>Thanks, I'll tinker with this concept to see if I can make some progress.</description>
      <pubDate>Tue, 20 Apr 2021 14:58:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Subracting-rows-where-duplicate-values-are-present-in-a-column/m-p/735596#M38626</guid>
      <dc:creator>hoaglam</dc:creator>
      <dc:date>2021-04-20T14:58:03Z</dc:date>
    </item>
  </channel>
</rss>

