<?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: Code for deleting repeated numbers in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Code-for-deleting-repeated-numbers/m-p/402186#M66822</link>
    <description>&lt;P&gt;Are you trying to remove all instances of these ID values?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;62105823&lt;/P&gt;
&lt;P&gt;62109009&lt;/P&gt;
&lt;P&gt;62115446&lt;/P&gt;</description>
    <pubDate>Sun, 08 Oct 2017 14:09:52 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-10-08T14:09:52Z</dc:date>
    <item>
      <title>Code for deleting repeated numbers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-for-deleting-repeated-numbers/m-p/402183#M66820</link>
      <description>&lt;P&gt;Hi guys&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking for code that will delete any number repeated three times or less of this column &lt;STRONG&gt;(COW_ID)&lt;/STRONG&gt;, and my dataset name is &lt;STRONG&gt;(work.mfd)&lt;/STRONG&gt;. I have over one million&amp;nbsp;observations in this column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;COW_ID&lt;/P&gt;&lt;P&gt;62103918&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62103918&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62103918&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62103918&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62105823&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62105823&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62105823&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62105952&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62105952&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62105952&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62105952&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62105952&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62109009&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62115446&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62115446&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62132148&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62132148&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62132148&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62132148&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62132148&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62132148&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;62132148&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;my regards&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ibrahim&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2017 13:24:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-for-deleting-repeated-numbers/m-p/402183#M66820</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2017-10-08T13:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: Code for deleting repeated numbers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-for-deleting-repeated-numbers/m-p/402184#M66821</link>
      <description>&lt;P&gt;Use adaptation of this code to mark all those records with &lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/63043/HTML/default/viewer.htm#p1nlqenp6yoyitn1tbz095cbvxt3.htm" target="_self"&gt;Counting Duplicate Rows in a Table&lt;/A&gt;, and then delete them&amp;nbsp;with&amp;nbsp;&lt;A href="https://v8doc.sas.com/sashtml/lgref/z0201996.htm" target="_self"&gt;DELETE&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I am assuming that by&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;delete any number repeated three times or less of this column&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;(COW_ID)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;you mean delete all records that repeat 3 times or less.&lt;BR /&gt;If you formulate it like that then that means that only records that appear 4x or higher will remain.&lt;BR /&gt;Nevertheless, you can change condition for deletion however you want in the DELETE statement &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2017 14:08:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-for-deleting-repeated-numbers/m-p/402184#M66821</guid>
      <dc:creator>Dusan_C</dc:creator>
      <dc:date>2017-10-08T14:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Code for deleting repeated numbers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-for-deleting-repeated-numbers/m-p/402186#M66822</link>
      <description>&lt;P&gt;Are you trying to remove all instances of these ID values?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;62105823&lt;/P&gt;
&lt;P&gt;62109009&lt;/P&gt;
&lt;P&gt;62115446&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2017 14:09:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-for-deleting-repeated-numbers/m-p/402186#M66822</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-10-08T14:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Code for deleting repeated numbers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-for-deleting-repeated-numbers/m-p/402188#M66823</link>
      <description>&lt;P&gt;Thanks&amp;nbsp; &lt;SPAN class="UserName lia-user-name lia-user-rank-Super-User"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954" target="_self"&gt;&lt;SPAN class="login-bold"&gt;Astounding&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;for your reply&lt;/P&gt;&lt;P&gt;yes ,that is what I need exactly&lt;/P&gt;&lt;P&gt;Any ideas please?&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2017 14:42:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-for-deleting-repeated-numbers/m-p/402188#M66823</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2017-10-08T14:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Code for deleting repeated numbers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-for-deleting-repeated-numbers/m-p/402189#M66824</link>
      <description>&lt;P&gt;A simple SQL query should do that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table want as
  select * 
  from have 
  group by cow_id
  having count(*) &amp;gt; 3 
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the data is sorted you could probably get a quicker result using a data step with a double DOW loop. First loop to count and second to control which records are output.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  do _N_=1 by 1 until (last.cowid);
    set have ;
    by cowid;
  end;
  do until (last.cowid);
    set have ;
    by cowid;
    if _N_ &amp;gt; 3 then output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2017 15:25:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-for-deleting-repeated-numbers/m-p/402189#M66824</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-10-08T15:25:43Z</dc:date>
    </item>
  </channel>
</rss>

