<?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: how to find the duplicated records with two combined IDS in sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-duplicated-records-with-two-combined-IDS-in-sas/m-p/753824#M237656</link>
    <description>&lt;P&gt;Run a count and use HAVING:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select id1, id2, count(*) as count
from have
group by id1, id2
having calculated count &amp;gt; 1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or run a proc freq or proc summary and filter out the observations with a count &amp;gt; 1.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Jul 2021 16:51:34 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-07-13T16:51:34Z</dc:date>
    <item>
      <title>how to find the duplicated records with two combined IDS in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-duplicated-records-with-two-combined-IDS-in-sas/m-p/753821#M237654</link>
      <description>&lt;P&gt;i have a dataset that has two ids: id1 and id2. i want to find out if there are any duplicated records for the combined id1 and id2. i created a code like this but it don't work. are there any easy way to do this in sas proc sql?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data combine;&lt;BR /&gt;set dataset;&lt;BR /&gt;combinedid=catx(id1, id2);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;BR /&gt;SELECT id1, id2, &lt;BR /&gt;FREQ(combinedid) AS dupe &lt;BR /&gt;FROM dataset&lt;BR /&gt;GROUP BY combinedid&lt;BR /&gt;HAVING dupe GE 2;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 16:46:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-duplicated-records-with-two-combined-IDS-in-sas/m-p/753821#M237654</guid>
      <dc:creator>juliajulia</dc:creator>
      <dc:date>2021-07-13T16:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the duplicated records with two combined IDS in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-duplicated-records-with-two-combined-IDS-in-sas/m-p/753824#M237656</link>
      <description>&lt;P&gt;Run a count and use HAVING:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select id1, id2, count(*) as count
from have
group by id1, id2
having calculated count &amp;gt; 1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or run a proc freq or proc summary and filter out the observations with a count &amp;gt; 1.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 16:51:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-duplicated-records-with-two-combined-IDS-in-sas/m-p/753824#M237656</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-07-13T16:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the duplicated records with two combined IDS in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-duplicated-records-with-two-combined-IDS-in-sas/m-p/753829#M237657</link>
      <description>Why use SQL at all? Why not use PROC SORT which has built in functions to help identify duplicates. Look at the NODUPKEY, NOUNIQUEKEY, DUPOUT, UNIQUEOUT options. &lt;BR /&gt;It can identify duplicates across multiple columns and easily separate them into their own data sets with no need to combine anything. &lt;BR /&gt;&lt;BR /&gt;You can definitely roll your own via SQL but it's faster, easier and more efficient to use the developed procedures.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Jul 2021 17:00:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-duplicated-records-with-two-combined-IDS-in-sas/m-p/753829#M237657</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-13T17:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the duplicated records with two combined IDS in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-duplicated-records-with-two-combined-IDS-in-sas/m-p/753831#M237659</link>
      <description>And you may want to sort those IDs first as well. &lt;BR /&gt;&lt;BR /&gt;ie should these be duplicates:&lt;BR /&gt;&lt;BR /&gt;ID1    ID2&lt;BR /&gt;ABC   DEF&lt;BR /&gt;DEF   ABC&lt;BR /&gt;&lt;BR /&gt;None of the posted solutions will deal with this scenario.</description>
      <pubDate>Tue, 13 Jul 2021 17:02:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-duplicated-records-with-two-combined-IDS-in-sas/m-p/753831#M237659</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-13T17:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the duplicated records with two combined IDS in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-duplicated-records-with-two-combined-IDS-in-sas/m-p/753838#M237661</link>
      <description>&lt;P&gt;Thank you all. Both proc sql and proc freq works with my case:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;select id1, id2, count(*) as count&lt;BR /&gt;from have&lt;BR /&gt;group by id1, id2&lt;BR /&gt;having calculated count &amp;gt; 1;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC FREQ data=have;&lt;BR /&gt;TABLES id1*id2 / noprint out=duplist;&lt;BR /&gt;RUN;&lt;BR /&gt;PROC PRINT data=duplist;&lt;BR /&gt;WHERE count ge 2;&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 17:24:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-the-duplicated-records-with-two-combined-IDS-in-sas/m-p/753838#M237661</guid>
      <dc:creator>juliajulia</dc:creator>
      <dc:date>2021-07-13T17:24:33Z</dc:date>
    </item>
  </channel>
</rss>

