<?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: Counting with conditions in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Counting-with-conditions/m-p/565006#M11132</link>
    <description>&lt;P&gt;Hi dray,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;u are right , i wanted to put records with count as 1 ,2,3 in separate datasets and ignore the last one and do some calculations with it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway ur solution is perfect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jun 2019 18:53:19 GMT</pubDate>
    <dc:creator>adi121</dc:creator>
    <dc:date>2019-06-10T18:53:19Z</dc:date>
    <item>
      <title>Counting with conditions</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-with-conditions/m-p/564808#M11109</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data test;&lt;BR /&gt;input ssn $9. ee_id$ EE_pyin $10. payamt;&lt;BR /&gt;cards;&lt;BR /&gt;093443789 322189 2018-06-01 1200&lt;BR /&gt;093443789 322189 2018-06-15 1200&lt;BR /&gt;093443789 322189 2018-06-29 1200&lt;BR /&gt;093443789 322189 2018-07-01 1300&lt;BR /&gt;094646665 112782 2018-03-09 2807&lt;BR /&gt;094646665 112782 2018-09-21 0054&lt;BR /&gt;;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in the above program there are 2 different ssn(social secuirty number), i want to count how many times he has paid.Till here it is working fine .But i dont want to include the last payment or you can say exclude the latest date for every ssn and then output all others as you can see below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pls help!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data=test;by ssn;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data a c1 c2 c3;&lt;BR /&gt;set test;&lt;BR /&gt;by ssn;&lt;BR /&gt;if first.ssn then c=0;&lt;BR /&gt;c+1;&lt;BR /&gt;if c=1 then output c1;&lt;BR /&gt;if c=2 then output c2;&lt;BR /&gt;if c=3 then output c3;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 05:23:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-with-conditions/m-p/564808#M11109</guid>
      <dc:creator>adi121</dc:creator>
      <dc:date>2019-06-10T05:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: Counting with conditions</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-with-conditions/m-p/564824#M11110</link>
      <description>&lt;P&gt;I don't understand what you try to do with c1, c2 and c3 in you data step? Do you want to create separate datas sets for each count or?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you simply want to exclude the latest payment, then do&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set test;
   by ssn; 
   if first.ssn then c=0;
   c+1;
   if not last.ssn;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Jun 2019 07:51:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-with-conditions/m-p/564824#M11110</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-06-10T07:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: Counting with conditions</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-with-conditions/m-p/565006#M11132</link>
      <description>&lt;P&gt;Hi dray,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;u are right , i wanted to put records with count as 1 ,2,3 in separate datasets and ignore the last one and do some calculations with it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway ur solution is perfect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 18:53:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-with-conditions/m-p/565006#M11132</guid>
      <dc:creator>adi121</dc:creator>
      <dc:date>2019-06-10T18:53:19Z</dc:date>
    </item>
  </channel>
</rss>

