<?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: Same account with debit and credits done. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Same-account-with-debit-and-credits-done/m-p/908850#M358587</link>
    <description>&lt;P&gt;Assuming we need to identify Accounts for which the same amount of debit and credit transactions done.&amp;nbsp; First separate data into debit and credit transactions, then merge the same accounts based on the same amount.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*Separate data into debit and credit transactions; 
data debit credit; 
	set have; 
	if Transaction_Codes in (401, 395, 11, 71 /*more codes here*/) then output debit; 
	else if Transaction_Codes in (402, 911, 394 /*more codes here*/) then output credit; 
	keep  Account_Number Transaction_Codes Transaction_Amount; 
run; 

*Merge back debit and credit transactions: if the same Amount occured for both credit and debit of the same Account; 
proc sql;
	create table want (drop AN TC TA) as
		select* from debit as a
			left join (select Account_Number as AN, Transaction_Codes as TC, Transaction_Amount as TA from credit) as b
		on a.Account_Number=b.AN and a.Transaction_Amount=b.TA
	order by Account_Number;
quit;  &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 19 Dec 2023 17:10:09 GMT</pubDate>
    <dc:creator>A_Kh</dc:creator>
    <dc:date>2023-12-19T17:10:09Z</dc:date>
    <item>
      <title>Same account with debit and credits done.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Same-account-with-debit-and-credits-done/m-p/908835#M358580</link>
      <description>&lt;P&gt;Hi, I have a data set where there is incoming and outgoing transactions happening based on transaction codes. I want to use this data Set to see if I look at transaction codes 401,395,11 and 71 I know it's all credits and transaction codes 402, 911 and 394 it's all debit that went through on the account. I need to build an output where the account number had a debit done on the account and then that some account number went and did a credit (reversal) on the account. So I only want to see the account number if there was a debit done for an x amount and then if there was a reversal done for the same amount.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope someone can help me.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 15:31:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Same-account-with-debit-and-credits-done/m-p/908835#M358580</guid>
      <dc:creator>MJM11111</dc:creator>
      <dc:date>2023-12-19T15:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: Same account with debit and credits done.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Same-account-with-debit-and-credits-done/m-p/908837#M358581</link>
      <description>&lt;P&gt;Please provide some example data (as working SAS data step code — &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;instructions&lt;/A&gt;&amp;nbsp;— do not provide data as Excel files or screen captures), the data and IDs can be fake as long as they are a good representation of the actual problem.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 15:36:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Same-account-with-debit-and-credits-done/m-p/908837#M358581</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-12-19T15:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: Same account with debit and credits done.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Same-account-with-debit-and-credits-done/m-p/908839#M358582</link>
      <description>&lt;P&gt;You will have to very carefully describe exactly how we can tell a "reversal" has been done based on the content of the data. That may well mean you have to explain what each of those codes you discuss actually means. Otherwise we have no way of telling when a "debit" that is the same as a "credit" is not just happenstance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Really, example data is going to be needed and quite possibly more clearly defined rules based on actual values that appear, such as the codes, in the data.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 15:49:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Same-account-with-debit-and-credits-done/m-p/908839#M358582</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-12-19T15:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: Same account with debit and credits done.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Same-account-with-debit-and-credits-done/m-p/908850#M358587</link>
      <description>&lt;P&gt;Assuming we need to identify Accounts for which the same amount of debit and credit transactions done.&amp;nbsp; First separate data into debit and credit transactions, then merge the same accounts based on the same amount.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*Separate data into debit and credit transactions; 
data debit credit; 
	set have; 
	if Transaction_Codes in (401, 395, 11, 71 /*more codes here*/) then output debit; 
	else if Transaction_Codes in (402, 911, 394 /*more codes here*/) then output credit; 
	keep  Account_Number Transaction_Codes Transaction_Amount; 
run; 

*Merge back debit and credit transactions: if the same Amount occured for both credit and debit of the same Account; 
proc sql;
	create table want (drop AN TC TA) as
		select* from debit as a
			left join (select Account_Number as AN, Transaction_Codes as TC, Transaction_Amount as TA from credit) as b
		on a.Account_Number=b.AN and a.Transaction_Amount=b.TA
	order by Account_Number;
quit;  &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Dec 2023 17:10:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Same-account-with-debit-and-credits-done/m-p/908850#M358587</guid>
      <dc:creator>A_Kh</dc:creator>
      <dc:date>2023-12-19T17:10:09Z</dc:date>
    </item>
  </channel>
</rss>

