<?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 remove duplicates in SAS 8.3 EG Query Builder in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-duplicates-in-SAS-8-3-EG-Query-Builder/m-p/762395#M39361</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/375181"&gt;@WorkUser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Can I remove duplicates by just a specific field rather than an entire row using the query builder?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not that I know of.&amp;nbsp; Generally that's not how SQL works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, you can use Proc Sort with a NODUPKEY option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC  SORT  DATA=Have  NODUPKEY;
    BY  ID, Date;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In the above example, only duplicates on both ID and Date will be eliminated.&amp;nbsp; If other columns in the dataset "Have" do not match, SAS will still drop a row if ID and Date match.&amp;nbsp; However, be aware, that SAS will just take the first one that it encounters.&amp;nbsp; If you have something like:&lt;BR /&gt;123 18AUG2021 Purchase&lt;/P&gt;
&lt;P&gt;123 18AUG2021 Return&lt;/P&gt;
&lt;P&gt;123 18AUG2021 Purchase&lt;/P&gt;
&lt;P&gt;Only the first "Purchase" record would be retained.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Aug 2021 22:51:16 GMT</pubDate>
    <dc:creator>jimbarbour</dc:creator>
    <dc:date>2021-08-18T22:51:16Z</dc:date>
    <item>
      <title>How to remove duplicates in SAS 8.3 EG Query Builder</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-duplicates-in-SAS-8-3-EG-Query-Builder/m-p/762367#M39357</link>
      <description>&lt;P&gt;Is there a way to remove duplicates in Query Builder? I usually check the “Select distinct rows only” box and it fixes the problem but in this case there are fields that don’t match so it will be included in the dataset. Can I remove duplicates by just a specific field rather than an entire row using the query builder?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2021 19:43:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-duplicates-in-SAS-8-3-EG-Query-Builder/m-p/762367#M39357</guid>
      <dc:creator>WorkUser</dc:creator>
      <dc:date>2021-08-18T19:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove duplicates in SAS 8.3 EG Query Builder</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-duplicates-in-SAS-8-3-EG-Query-Builder/m-p/762383#M39360</link>
      <description>&lt;P&gt;If there are other variables that you need how do you identify which values of the other variables that you want?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2021 21:14:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-duplicates-in-SAS-8-3-EG-Query-Builder/m-p/762383#M39360</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-18T21:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove duplicates in SAS 8.3 EG Query Builder</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-duplicates-in-SAS-8-3-EG-Query-Builder/m-p/762395#M39361</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/375181"&gt;@WorkUser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Can I remove duplicates by just a specific field rather than an entire row using the query builder?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not that I know of.&amp;nbsp; Generally that's not how SQL works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, you can use Proc Sort with a NODUPKEY option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC  SORT  DATA=Have  NODUPKEY;
    BY  ID, Date;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In the above example, only duplicates on both ID and Date will be eliminated.&amp;nbsp; If other columns in the dataset "Have" do not match, SAS will still drop a row if ID and Date match.&amp;nbsp; However, be aware, that SAS will just take the first one that it encounters.&amp;nbsp; If you have something like:&lt;BR /&gt;123 18AUG2021 Purchase&lt;/P&gt;
&lt;P&gt;123 18AUG2021 Return&lt;/P&gt;
&lt;P&gt;123 18AUG2021 Purchase&lt;/P&gt;
&lt;P&gt;Only the first "Purchase" record would be retained.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2021 22:51:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-duplicates-in-SAS-8-3-EG-Query-Builder/m-p/762395#M39361</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-08-18T22:51:16Z</dc:date>
    </item>
  </channel>
</rss>

