<?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: finding odd in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621633#M182763</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines dlm="09"x;
	input sno DEBIT CREDIT CHEQUEID VDATE:date9.;
	format VDATE date9.;
	datalines;
2	200	0	1234	1-Jan-20
3	0	200	1234	2-Jan-20
4	400	0	4567	1-Jan-20
5	0	400	4567	1-Jan-20
6	400	0	4567	2-Jan-20
;
run;

data match1;
	merge have have(keep= CREDIT CHEQUEID rename=(CREDIT=CREDIT2 CHEQUEID=CHEQUEID2) firstobs=2);
	if DEBIT=CREDIT2 and DEBIT&amp;gt;0 and CHEQUEID=CHEQUEID2 then flagd=1;
	drop CREDIT2 CHEQUEID2;
run;

data match2;
	set match1 ;
	if _n_&amp;gt;1 then set match1(keep=flagd rename=(flagd=flagc));
	length flag $ 8;
	if flagd or flagc then flag="match";
	else flag="mismatch";
	drop flagc flagd;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 02 Feb 2020 09:13:54 GMT</pubDate>
    <dc:creator>ed_sas_member</dc:creator>
    <dc:date>2020-02-02T09:13:54Z</dc:date>
    <item>
      <title>finding odd</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621621#M182755</link>
      <description>&lt;P&gt;I have input&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="349"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;sno&lt;/TD&gt;
&lt;TD width="64"&gt;DEBIT&lt;/TD&gt;
&lt;TD width="64"&gt;CREDIT&lt;/TD&gt;
&lt;TD width="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gt;
&lt;TD&gt;2-Jan-20&lt;/TD&gt;
&lt;TD colspan="2"&gt;mismatch&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;when debit = credit the flag should be raised as MATCH else MISMATCH&lt;/P&gt;</description>
      <pubDate>Sat, 01 Feb 2020 11:23:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621621#M182755</guid>
      <dc:creator>rohithverma</dc:creator>
      <dc:date>2020-02-01T11:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: finding odd</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621622#M182756</link>
      <description>&lt;P&gt;Please don't make us guess. Explain the logic that is used to turn the initial table into the final table.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Feb 2020 11:27:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621622#M182756</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-01T11:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: finding odd</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621623#M182757</link>
      <description>&lt;P&gt;logic is when the debit amount is equals to credit amount then the flag should be raised as "MATCH"&lt;/P&gt;
&lt;P&gt;or else "MISMATCH" should be raised&lt;/P&gt;</description>
      <pubDate>Sat, 01 Feb 2020 11:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621623#M182757</guid>
      <dc:creator>rohithverma</dc:creator>
      <dc:date>2020-02-01T11:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: finding odd</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621628#M182759</link>
      <description>&lt;P&gt;How do you identify which credit should be compared with which debit?&amp;nbsp; It doesn't appear that SNO, CHEQUEID, or VDATE will help us pair up records.&amp;nbsp; Should they simply be paired based on their positions within the data set?&amp;nbsp; (i.e. first two records taken together, then the next two, etc.)&lt;/P&gt;</description>
      <pubDate>Sat, 01 Feb 2020 11:51:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621628#M182759</guid>
      <dc:creator>jmhorstman</dc:creator>
      <dc:date>2020-02-01T11:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: finding odd</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621629#M182760</link>
      <description>&lt;P&gt;you can see the common chequeid .So for the common chequeid&amp;nbsp; we need to find&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Feb 2020 11:53:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621629#M182760</guid>
      <dc:creator>rohithverma</dc:creator>
      <dc:date>2020-02-01T11:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: finding odd</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621630#M182761</link>
      <description>There are 3 records for CHEQUEID=4567.  How did you decide that records 4 and 5 match and record 6 is a mismatch?  It would be helpful if you can give the precise logic to be used.</description>
      <pubDate>Sat, 01 Feb 2020 11:59:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621630#M182761</guid>
      <dc:creator>jmhorstman</dc:creator>
      <dc:date>2020-02-01T11:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: finding odd</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621631#M182762</link>
      <description>&lt;P&gt;So 4567 appears three times in the original data, how is it decided which one is the mismatch.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please give us a full description of the logic used with this data, instead of these incredibly incomplete and partial descriptions.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Feb 2020 11:59:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621631#M182762</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-01T11:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: finding odd</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621633#M182763</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines dlm="09"x;
	input sno DEBIT CREDIT CHEQUEID VDATE:date9.;
	format VDATE date9.;
	datalines;
2	200	0	1234	1-Jan-20
3	0	200	1234	2-Jan-20
4	400	0	4567	1-Jan-20
5	0	400	4567	1-Jan-20
6	400	0	4567	2-Jan-20
;
run;

data match1;
	merge have have(keep= CREDIT CHEQUEID rename=(CREDIT=CREDIT2 CHEQUEID=CHEQUEID2) firstobs=2);
	if DEBIT=CREDIT2 and DEBIT&amp;gt;0 and CHEQUEID=CHEQUEID2 then flagd=1;
	drop CREDIT2 CHEQUEID2;
run;

data match2;
	set match1 ;
	if _n_&amp;gt;1 then set match1(keep=flagd rename=(flagd=flagc));
	length flag $ 8;
	if flagd or flagc then flag="match";
	else flag="mismatch";
	drop flagc flagd;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Feb 2020 09:13:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621633#M182763</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-02T09:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: finding odd</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621662#M182784</link>
      <description>Hi Ed ,really it's awesome it works .Could you please explain the second datastep match2 working please .I am bit confused what's happening in that .</description>
      <pubDate>Sat, 01 Feb 2020 18:35:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621662#M182784</guid>
      <dc:creator>rohithverma</dc:creator>
      <dc:date>2020-02-01T18:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: finding odd</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621746#M182830</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/150852"&gt;@rohithverma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Awesome!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is how the code works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Step1:&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sans titre 1.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/35805i35F04402FB44BA63/image-size/large?v=v2&amp;amp;px=999" role="button" title="Sans titre 1.jpg" alt="Sans titre 1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Step2:&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sans titre2.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/35806i3C6370539B90409D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Sans titre2.jpg" alt="Sans titre2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the main assumption is that matching records can only be n and n+1.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Feb 2020 09:48:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621746#M182830</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-02T09:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: finding odd</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621793#M182848</link>
      <description>thank you so much</description>
      <pubDate>Sun, 02 Feb 2020 17:48:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621793#M182848</guid>
      <dc:creator>rohithverma</dc:creator>
      <dc:date>2020-02-02T17:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: finding odd</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621878#M182891</link>
      <description>&lt;P&gt;A small doubt&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As we are doing set when _n_ &amp;gt;1 the at the point of time for flag c the first value will be "." .Why this will happens .Please explain this&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 07:27:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621878#M182891</guid>
      <dc:creator>rohithverma</dc:creator>
      <dc:date>2020-02-03T07:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: finding odd</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621882#M182893</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/150852"&gt;@rohithverma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no issue according to these assumptions as the flag for matching credit records ('flagc') can occur only from the second row.&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 08:07:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-odd/m-p/621882#M182893</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-03T08:07:44Z</dc:date>
    </item>
  </channel>
</rss>

