<?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: Help with removing duplicates in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-removing-duplicates/m-p/71712#M20717</link>
    <description>agree with sbb&lt;BR /&gt;
&lt;BR /&gt;
easy to say:&lt;BR /&gt;
&lt;BR /&gt;
proc sort data=test ; by id descending date;&lt;BR /&gt;
&lt;BR /&gt;
data lastdate;&lt;BR /&gt;
  set test;&lt;BR /&gt;
  by id descending date;&lt;BR /&gt;
if first.id;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
of course double check your data and make sure you get what you want!</description>
    <pubDate>Wed, 16 Sep 2009 21:21:27 GMT</pubDate>
    <dc:creator>Stephanie55901</dc:creator>
    <dc:date>2009-09-16T21:21:27Z</dc:date>
    <item>
      <title>Help with removing duplicates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-removing-duplicates/m-p/71710#M20715</link>
      <description>Hi,&lt;BR /&gt;
I am fairly new to using SAS and require some assistance. My data set (Test) contains many duplicates and i need to remove the duplicates by a date field. Both the Nodup and Nodupkey functions do not provide me the results i need. The 'test' data set contains a list of accounts, the acctnum is the primary identifier, and multiple records for these accounts are coming back, i only want to keep the record with the most recent date.&lt;BR /&gt;
Can someone please help?&lt;BR /&gt;
Thanks.</description>
      <pubDate>Wed, 16 Sep 2009 14:32:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-removing-duplicates/m-p/71710#M20715</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-09-16T14:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help with removing duplicates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-removing-duplicates/m-p/71711#M20716</link>
      <description>Explore using two sorts, the first to get the desired "first condition" ordered at the beginning (ahead of any duplicates - using DESCENDING &lt;YOUR_DATE_VARIABLE&gt; in the BY list) followed by a less-discreted SORT with EQUALS specified in the PROC SORT command.&lt;BR /&gt;
&lt;BR /&gt;
Or another option is to use PROC SORT to get your data in the proper order (with the appropriate BY statement variables and, again, using DESCENDING &lt;YOUR_DATE_VARIABLE&gt; in the BY list.&lt;BR /&gt;
&lt;BR /&gt;
The use a DATA step approach with a BY statement and a list of the sort-variables listed that you want to test using the IF FIRST.&lt;BREAK_VARIABLE&gt;  (or maybe IF LAST.&lt;BREAK_VARIABLE&gt;) -- choice of whether to use FIRST. or LAST.  will depend on how you decide to sort your input file (with or without DESCENDING).&lt;BR /&gt;
&lt;BR /&gt;
The SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website has SAS-hosted documentation and supplemental technical and conference topic-related reference materials.  Here are a few Google advanced arguments for you to use to find suitable matches on this topic for discussion / example code:&lt;BR /&gt;
&lt;BR /&gt;
remove duplicates equals site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
by first last processing site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Also, this topic has been discussed on the SAS Discussion Forums, if you want to search the archives.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;/BREAK_VARIABLE&gt;&lt;/BREAK_VARIABLE&gt;&lt;/YOUR_DATE_VARIABLE&gt;&lt;/YOUR_DATE_VARIABLE&gt;</description>
      <pubDate>Wed, 16 Sep 2009 15:25:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-removing-duplicates/m-p/71711#M20716</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-09-16T15:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help with removing duplicates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-removing-duplicates/m-p/71712#M20717</link>
      <description>agree with sbb&lt;BR /&gt;
&lt;BR /&gt;
easy to say:&lt;BR /&gt;
&lt;BR /&gt;
proc sort data=test ; by id descending date;&lt;BR /&gt;
&lt;BR /&gt;
data lastdate;&lt;BR /&gt;
  set test;&lt;BR /&gt;
  by id descending date;&lt;BR /&gt;
if first.id;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
of course double check your data and make sure you get what you want!</description>
      <pubDate>Wed, 16 Sep 2009 21:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-removing-duplicates/m-p/71712#M20717</guid>
      <dc:creator>Stephanie55901</dc:creator>
      <dc:date>2009-09-16T21:21:27Z</dc:date>
    </item>
  </channel>
</rss>

