<?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 Playing with duplicate entries in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Playing-with-duplicate-entries/m-p/31699#M6095</link>
    <description>I have a dataset which has multiple duplicate entries, say for variable "abc". Now, in the dataset, some values for this variable will have 3/4/6/7 duplicate entries. &lt;BR /&gt;
&lt;BR /&gt;
What I want to do is only pick up the first 2 duplicate entires, so in the new dataset every value for variable "abc" has 2 duplicate entries.&lt;BR /&gt;
&lt;BR /&gt;
Can someone help?&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
    <pubDate>Thu, 17 Jul 2008 06:07:13 GMT</pubDate>
    <dc:creator>tejeshwar</dc:creator>
    <dc:date>2008-07-17T06:07:13Z</dc:date>
    <item>
      <title>Playing with duplicate entries</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Playing-with-duplicate-entries/m-p/31699#M6095</link>
      <description>I have a dataset which has multiple duplicate entries, say for variable "abc". Now, in the dataset, some values for this variable will have 3/4/6/7 duplicate entries. &lt;BR /&gt;
&lt;BR /&gt;
What I want to do is only pick up the first 2 duplicate entires, so in the new dataset every value for variable "abc" has 2 duplicate entries.&lt;BR /&gt;
&lt;BR /&gt;
Can someone help?&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Thu, 17 Jul 2008 06:07:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Playing-with-duplicate-entries/m-p/31699#M6095</guid>
      <dc:creator>tejeshwar</dc:creator>
      <dc:date>2008-07-17T06:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Playing with duplicate entries</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Playing-with-duplicate-entries/m-p/31700#M6096</link>
      <description>What you have to do is : 1) sort your dataset 2) read the sorted data with a Data step and create a new variable 3) this variable will be zeroed for each new value of ABC 4) this variable will be added 1 on every observation 5) keep the observation if the new variable is less or equal to 2.&lt;BR /&gt;
[pre]&lt;BR /&gt;
PROC SORT DATA = myData OUT = sortedData ;&lt;BR /&gt;
   BY abc whatEver ;&lt;BR /&gt;
RUN ;&lt;BR /&gt;
DATA first2dup (WHERE=(countObs LE 2)) ;&lt;BR /&gt;
  SET sortedData ;&lt;BR /&gt;
  BY abc ;&lt;BR /&gt;
  IF FIRST.abc THEN countObs = 0 ;&lt;BR /&gt;
  countObs + 1 ;&lt;BR /&gt;
RUN ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Regards.&lt;BR /&gt;
Olivier</description>
      <pubDate>Thu, 17 Jul 2008 07:04:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Playing-with-duplicate-entries/m-p/31700#M6096</guid>
      <dc:creator>Olivier</dc:creator>
      <dc:date>2008-07-17T07:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: Playing with duplicate entries</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Playing-with-duplicate-entries/m-p/31701#M6097</link>
      <description>thanks Oliver, this works great!</description>
      <pubDate>Thu, 17 Jul 2008 10:46:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Playing-with-duplicate-entries/m-p/31701#M6097</guid>
      <dc:creator>tejeshwar</dc:creator>
      <dc:date>2008-07-17T10:46:24Z</dc:date>
    </item>
  </channel>
</rss>

