<?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: Duplicates in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Duplicates/m-p/74463#M21617</link>
    <description>proc sort data= ccar.hierarchy out=ccar.out;&lt;BR /&gt;
  where SiteID = 80; &lt;BR /&gt;
  by Level_7_id;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data ccar.out ccar.dupes_Level_7_ID;&lt;BR /&gt;
  set ccar.out;&lt;BR /&gt;
  by Level_7_id;&lt;BR /&gt;
  if first.Level_7_id and last.Level_7_id then output ccar.out;&lt;BR /&gt;
  else &lt;BR /&gt;
  do;&lt;BR /&gt;
    if first.Level_7_id then output ccar.out&lt;BR /&gt;
    output ccar.dupes_Level_7_ID;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
    <pubDate>Fri, 24 Sep 2010 11:59:15 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2010-09-24T11:59:15Z</dc:date>
    <item>
      <title>Duplicates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Duplicates/m-p/74460#M21614</link>
      <description>Hello &lt;BR /&gt;
&lt;BR /&gt;
If i have two records that are not an exact duplicate but contain a duplicate ID field, how can i create a dataset containing both records?&lt;BR /&gt;
&lt;BR /&gt;
I've only been able to return the first record to this point, the second is deleted.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
&lt;BR /&gt;
Fred</description>
      <pubDate>Fri, 24 Sep 2010 10:56:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Duplicates/m-p/74460#M21614</guid>
      <dc:creator>fredbell</dc:creator>
      <dc:date>2010-09-24T10:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Duplicates/m-p/74461#M21615</link>
      <description>Posting the code used to accomplish the task increases the chance to get useful answers.</description>
      <pubDate>Fri, 24 Sep 2010 11:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Duplicates/m-p/74461#M21615</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2010-09-24T11:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Duplicates/m-p/74462#M21616</link>
      <description>Ok below is what i am using, it only keeps the first record and deletes the other.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc sort data= ccar.hierarchy out=ccar.out nodupkey dupout=ccar.dupes_Level_7_ID;&lt;BR /&gt;
where SiteID = 80; &lt;BR /&gt;
by Level_7_id;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Fred</description>
      <pubDate>Fri, 24 Sep 2010 11:48:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Duplicates/m-p/74462#M21616</guid>
      <dc:creator>fredbell</dc:creator>
      <dc:date>2010-09-24T11:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Duplicates/m-p/74463#M21617</link>
      <description>proc sort data= ccar.hierarchy out=ccar.out;&lt;BR /&gt;
  where SiteID = 80; &lt;BR /&gt;
  by Level_7_id;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data ccar.out ccar.dupes_Level_7_ID;&lt;BR /&gt;
  set ccar.out;&lt;BR /&gt;
  by Level_7_id;&lt;BR /&gt;
  if first.Level_7_id and last.Level_7_id then output ccar.out;&lt;BR /&gt;
  else &lt;BR /&gt;
  do;&lt;BR /&gt;
    if first.Level_7_id then output ccar.out&lt;BR /&gt;
    output ccar.dupes_Level_7_ID;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Fri, 24 Sep 2010 11:59:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Duplicates/m-p/74463#M21617</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2010-09-24T11:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Duplicates/m-p/74464#M21618</link>
      <description>Thanks, please see resulting error&lt;BR /&gt;
&lt;BR /&gt;
ERROR 455-185: Data set was not specified on the DATA statement.&lt;BR /&gt;
&lt;BR /&gt;
Fred</description>
      <pubDate>Fri, 24 Sep 2010 12:06:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Duplicates/m-p/74464#M21618</guid>
      <dc:creator>fredbell</dc:creator>
      <dc:date>2010-09-24T12:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Duplicates/m-p/74465#M21619</link>
      <description>Hi everyone&lt;BR /&gt;
&lt;BR /&gt;
I used this code and it worked, finally.&lt;BR /&gt;
&lt;BR /&gt;
proc sort data= ccar.hierarchy out=ccar.out;&lt;BR /&gt;
where SiteID = 80; &lt;BR /&gt;
by Level_7_id;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data single dup;&lt;BR /&gt;
set ccar.out;&lt;BR /&gt;
by Level_7_ID;&lt;BR /&gt;
if first.Level_7_ID and last.Level_7_ID then output single;&lt;BR /&gt;
else output dup;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Fred</description>
      <pubDate>Fri, 24 Sep 2010 13:22:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Duplicates/m-p/74465#M21619</guid>
      <dc:creator>fredbell</dc:creator>
      <dc:date>2010-09-24T13:22:19Z</dc:date>
    </item>
  </channel>
</rss>

