<?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: Get first unique values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Get-first-unique-values/m-p/723842#M224695</link>
    <description>&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have out=want nodupkey;
   by id arrange_date;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 05 Mar 2021 11:15:48 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2021-03-05T11:15:48Z</dc:date>
    <item>
      <title>Get first unique values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-first-unique-values/m-p/723832#M224691</link>
      <description>&lt;P&gt;Hello, this is the dataset I have available:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="c-mrkdwn__pre"&gt;data Have;
input ID arrange_date :ddmmyy. datestamp :ddmmyy.;
format arrange_date datestamp ddmmyy10.;
datalines;
001 05/06/2020 01/06/2020
001 05/07/2020 01/06/2020
001 05/08/2020 01/06/2020
001 05/06/2020 02/06/2020
001 05/07/2020 02/06/2020
001 05/08/2020 02/06/2020
001 05/06/2020 03/06/2020
001 05/07/2020 03/06/2020
001 05/08/2020 03/06/2020&lt;BR /&gt;&lt;BR /&gt;001 10/10/2020 03/10/2020
001 10/11/2020 03/10/2020
001 10/12/2020 03/10/2020
001 10/10/2020 04/10/2020
001 10/11/2020 04/10/2020
001 10/12/2020 04/10/2020&lt;BR /&gt;&lt;BR /&gt;002 20/03/2020 10/03/2020
002 20/04/2020 10/03/2020
002 20/05/2020 10/03/2020
002 20/06/2020 10/03/2020
002 20/03/2020 11/03/2020
002 20/04/2020 11/03/2020
002 20/05/2020 11/03/2020
002 20/06/2020 11/03/2020;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;To clarify:&amp;nbsp;&lt;/P&gt;&lt;P&gt;-There are many client ID's.&lt;/P&gt;&lt;P&gt;-The second column refers to certain arranged dates when the client needs to perform an action.&amp;nbsp;&lt;/P&gt;&lt;P&gt;-The third column is the datestamp.&amp;nbsp;&lt;/P&gt;&lt;P&gt;-There is one row per client's arrangement date, per datestamp.&amp;nbsp;As you can see, client 001 has two different "periods" in this table, one that goes from 05/06 and another that starts in 10/10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm interested in keeping only the&lt;STRONG&gt; first unique occurrences&amp;nbsp;of arrange_date&lt;/STRONG&gt;. In this case it would look like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
input ID arrange_date :ddmmyy. datestamp :ddmmyy.;
format arrange_date datestamp ddmmyy10.;
datalines;
001 05/06/2020 01/06/2020
001 05/07/2020 01/06/2020
001 05/08/2020 01/06/2020

001 10/10/2020 03/10/2020
001 10/11/2020 03/10/2020
001 10/12/2020 03/10/2020

002 20/03/2020 10/03/2020
002 20/04/2020 10/03/2020
002 20/05/2020 10/03/2020
002 20/06/2020 10/03/2020

;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;As you can see, I only kept the first occurrence of each "arrange_date".&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm okay if it's done either in proc sql or a data step.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 10:52:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-first-unique-values/m-p/723832#M224691</guid>
      <dc:creator>catkat96</dc:creator>
      <dc:date>2021-03-05T10:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get first unique values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-first-unique-values/m-p/723842#M224695</link>
      <description>&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have out=want nodupkey;
   by id arrange_date;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Mar 2021 11:15:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-first-unique-values/m-p/723842#M224695</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-03-05T11:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: Get first unique values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-first-unique-values/m-p/723881#M224715</link>
      <description>yes, perfect! I was juggling more complex things in my mind but sometimes simpler is better!!</description>
      <pubDate>Fri, 05 Mar 2021 14:44:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-first-unique-values/m-p/723881#M224715</guid>
      <dc:creator>catkat96</dc:creator>
      <dc:date>2021-03-05T14:44:29Z</dc:date>
    </item>
  </channel>
</rss>

