<?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 records into separate dataset. in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Duplicates-records-into-separate-dataset/m-p/7987#M2434</link>
    <description>data have;&lt;BR /&gt;
  a=1;b=1;c=1; output;&lt;BR /&gt;
  a=1;b=2;c=1; output;&lt;BR /&gt;
  a=2;b=2;c=1; output;&lt;BR /&gt;
  a=1;b=2;c=1; output;&lt;BR /&gt;
  a=1;b=2;c=1; output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
/* for duplicates: Keeps the first rec in want1, moves all other recs to DupsWant1 */&lt;BR /&gt;
proc sort data=have out=want1 dupout=DupsWant1 noduprec;&lt;BR /&gt;
  by a b c;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
/* Creates a table with duplicates, a table with all obs having no duplicates, and a table with all de-duped obs */&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create table Duplicates as&lt;BR /&gt;
    select *, count(*) as N_Dups&lt;BR /&gt;
    from have&lt;BR /&gt;
    group by a,b,c&lt;BR /&gt;
    having count(*)&amp;gt;1&lt;BR /&gt;
  ;&lt;BR /&gt;
&lt;BR /&gt;
  create table ObsWithNoDuplicates as&lt;BR /&gt;
    select *&lt;BR /&gt;
    from have&lt;BR /&gt;
    group by a,b,c&lt;BR /&gt;
    having count(*)=1&lt;BR /&gt;
    ;&lt;BR /&gt;
&lt;BR /&gt;
  create table AllObsDeDuped as&lt;BR /&gt;
    select DISTINCT *&lt;BR /&gt;
    from have&lt;BR /&gt;
    ;&lt;BR /&gt;
&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
    <pubDate>Mon, 06 Jun 2011 21:25:29 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2011-06-06T21:25:29Z</dc:date>
    <item>
      <title>Duplicates records into separate dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Duplicates-records-into-separate-dataset/m-p/7986#M2433</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
    I trying to keep duplicate records in sepate dataset.I' doing it like this,but having problem with large data.Can anybody suggest how can i do this in other&lt;BR /&gt;
way.&lt;BR /&gt;
&lt;BR /&gt;
 proc freq data = b noprint ;&lt;BR /&gt;
         /*by DRC_CASE_ID Milestone_Date Product MILESTONE_TYPE ;*/&lt;BR /&gt;
         table DRC_CASE_ID*Milestone_Date*Product*MILESTONE_TYPE*DAYS_OF_THERAPY / out =&lt;BR /&gt;
         test18(drop=percent where = (Count &amp;gt;1));&lt;BR /&gt;
    run;&lt;BR /&gt;
&lt;BR /&gt;
ERROR: The requested table is too large to process.&lt;BR /&gt;
NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;
NOTE: There were 219548 observations read from the data set WORK.B.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
brm</description>
      <pubDate>Mon, 06 Jun 2011 20:29:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Duplicates-records-into-separate-dataset/m-p/7986#M2433</guid>
      <dc:creator>brm</dc:creator>
      <dc:date>2011-06-06T20:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicates records into separate dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Duplicates-records-into-separate-dataset/m-p/7987#M2434</link>
      <description>data have;&lt;BR /&gt;
  a=1;b=1;c=1; output;&lt;BR /&gt;
  a=1;b=2;c=1; output;&lt;BR /&gt;
  a=2;b=2;c=1; output;&lt;BR /&gt;
  a=1;b=2;c=1; output;&lt;BR /&gt;
  a=1;b=2;c=1; output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
/* for duplicates: Keeps the first rec in want1, moves all other recs to DupsWant1 */&lt;BR /&gt;
proc sort data=have out=want1 dupout=DupsWant1 noduprec;&lt;BR /&gt;
  by a b c;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
/* Creates a table with duplicates, a table with all obs having no duplicates, and a table with all de-duped obs */&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create table Duplicates as&lt;BR /&gt;
    select *, count(*) as N_Dups&lt;BR /&gt;
    from have&lt;BR /&gt;
    group by a,b,c&lt;BR /&gt;
    having count(*)&amp;gt;1&lt;BR /&gt;
  ;&lt;BR /&gt;
&lt;BR /&gt;
  create table ObsWithNoDuplicates as&lt;BR /&gt;
    select *&lt;BR /&gt;
    from have&lt;BR /&gt;
    group by a,b,c&lt;BR /&gt;
    having count(*)=1&lt;BR /&gt;
    ;&lt;BR /&gt;
&lt;BR /&gt;
  create table AllObsDeDuped as&lt;BR /&gt;
    select DISTINCT *&lt;BR /&gt;
    from have&lt;BR /&gt;
    ;&lt;BR /&gt;
&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Mon, 06 Jun 2011 21:25:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Duplicates-records-into-separate-dataset/m-p/7987#M2434</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2011-06-06T21:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicates records into separate dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Duplicates-records-into-separate-dataset/m-p/7988#M2435</link>
      <description>Thanks a lot....those worked fine for me.</description>
      <pubDate>Tue, 07 Jun 2011 22:42:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Duplicates-records-into-separate-dataset/m-p/7988#M2435</guid>
      <dc:creator>brm</dc:creator>
      <dc:date>2011-06-07T22:42:14Z</dc:date>
    </item>
  </channel>
</rss>

