<?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: comparison between different columns in different rows in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619247#M19357</link>
    <description>&lt;P&gt;This is a very limited example; are all the rows paired as you show with debit in row 1 and credit in row 2? It's hard to generalize from one example.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;How do you arrive at the values of X?&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jan 2020 17:36:54 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-01-22T17:36:54Z</dc:date>
    <item>
      <title>comparison between different columns in different rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619244#M19356</link>
      <description>&lt;P&gt;i have a input like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sno&amp;nbsp; loanno&amp;nbsp; debit&amp;nbsp; &amp;nbsp; &amp;nbsp; credit&amp;nbsp; &amp;nbsp; &amp;nbsp; cheqno&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; 1234&amp;nbsp; &amp;nbsp; &amp;nbsp;200&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 222&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; 1234&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;200&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 222&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here we have to check whether the debit amount is equal to credit amount based on the cheqno only and if it is equal&amp;nbsp;&lt;/P&gt;&lt;P&gt;the o/p should be like&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sno&amp;nbsp; loanno&amp;nbsp; debit&amp;nbsp; &amp;nbsp; &amp;nbsp; credit&amp;nbsp; &amp;nbsp; &amp;nbsp; cheqno&amp;nbsp; &amp;nbsp; &amp;nbsp;x&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; 1234&amp;nbsp; &amp;nbsp; &amp;nbsp;200&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 222&amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; 1234&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;200&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 222&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 17:30:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619244#M19356</guid>
      <dc:creator>rohithverma</dc:creator>
      <dc:date>2020-01-22T17:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: comparison between different columns in different rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619247#M19357</link>
      <description>&lt;P&gt;This is a very limited example; are all the rows paired as you show with debit in row 1 and credit in row 2? It's hard to generalize from one example.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;How do you arrive at the values of X?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 17:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619247#M19357</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-01-22T17:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: comparison between different columns in different rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619249#M19358</link>
      <description>&lt;P&gt;No, all the rows won't be like this but in between for some of the cheque id's the debit amount and credit are present as i mentioned in the question .So here the comparison should be made between the two rows and if debit is equal to credit then&amp;nbsp; those two records should fetch in the output .Please ignore variable "X"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 17:43:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619249#M19358</guid>
      <dc:creator>rohithverma</dc:creator>
      <dc:date>2020-01-22T17:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: comparison between different columns in different rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619252#M19359</link>
      <description>I think you'll need to provide more sample data, otherwise it's very likely any solution provided will only work on the case above. Try and include a case for each possible outcome you need to consider.</description>
      <pubDate>Wed, 22 Jan 2020 17:52:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619252#M19359</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-01-22T17:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: comparison between different columns in different rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619254#M19360</link>
      <description>&lt;P&gt;Is there always exactly one credit and exactly one debit for each cheque?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Could there be more than one credit or more than one debit for each cheque? Could there be zero credit lines or zero debit lines for a cheque?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Agreeing with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;, this is not enough data to write working code, and we need a larger data set that covers all possible cases of what might happen.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 17:56:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619254#M19360</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-01-22T17:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: comparison between different columns in different rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619256#M19361</link>
      <description>&lt;P&gt;These are all the possible cases in the data as mentioned below .But here we need to consider only for which the cheque id's are equal for subsequent records should be considered along with that the debit amount should be equal to credit amount and if there are any open accounts like sno 5 &amp;amp; 6 for those the key variable will be loan no. For remaining we need to consider the cheque ids&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;sno&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;loan&lt;/TD&gt;&lt;TD&gt;dbamt&lt;/TD&gt;&lt;TD&gt;cramt&lt;/TD&gt;&lt;TD&gt;cheque&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1234&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&l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;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;456&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 22 Jan 2020 18:06:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619256#M19361</guid>
      <dc:creator>rohithverma</dc:creator>
      <dc:date>2020-01-22T18:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: comparison between different columns in different rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619263#M19362</link>
      <description>&lt;P&gt;Okay, thank you. Now show us the desired output from this.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 18:33:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619263#M19362</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-01-22T18:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: comparison between different columns in different rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619396#M19382</link>
      <description>&lt;P&gt;So, now the desired output is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;loan&lt;/TD&gt;&lt;TD&gt;dbamt&lt;/TD&gt;&lt;TD&gt;cramt&lt;/TD&gt;&lt;TD&gt;cheque&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1234&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;222&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1234&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;222&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1234&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;222&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1234&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;222&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7890&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;345&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7890&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;345&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Thu, 23 Jan 2020 02:45:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619396#M19382</guid>
      <dc:creator>rohithverma</dc:creator>
      <dc:date>2020-01-23T02:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: comparison between different columns in different rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619412#M19386</link>
      <description>&lt;P&gt;Not sure that I fully understood but if your sample data really covers all the cases then below will give you the desired output as shown.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines truncover dlm='|';
  input sno loan dbamt cramt cheque $;
  datalines;
1|1234|200|0|222
2|1234|0|200|222
3|1234|200|0|222
4|1234|0|200|222
5|1456|300|0|333
6|1389|400|0|444
7|7890|200|0|345
8|7890|0|200|345
9|7890|200|0|456
;

proc sql;
/*  create table maybe_want as*/
  select *
  from have
  group by cheque
  having sum(dbamt)=sum(cramt)
  order by sno
  ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jan 2020 05:39:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619412#M19386</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-01-23T05:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: comparison between different columns in different rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619415#M19388</link>
      <description>&lt;P&gt;No it wasn't giving any error but it wasn't creating any data too.In the output there was no data.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 06:16:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619415#M19388</guid>
      <dc:creator>rohithverma</dc:creator>
      <dc:date>2020-01-23T06:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: comparison between different columns in different rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619713#M19427</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/150852"&gt;@rohithverma&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;No it wasn't giving any error but it wasn't creating any data too.In the output there was no data.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you want the code to create a table then un-comment the Create Table statement in the SQL.&lt;/P&gt;
&lt;P&gt;The code I've posted executed as-is will create below report:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 212px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/35590iA4D0EA812FACA5A7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 23:27:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/comparison-between-different-columns-in-different-rows/m-p/619713#M19427</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-01-23T23:27:58Z</dc:date>
    </item>
  </channel>
</rss>

