<?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: Taking the earliest observation (by date) that fulfills a certain condition in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151678#M11868</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi in EG you can use the query builder to select and filter the data or u can try this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;Proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;sql&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;Create&lt;/SPAN&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; want &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; id, measurement, min(dates), controlled &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; have&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; controlled=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;group&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; id&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;having&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; count(*) gt &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Untested~&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 May 2014 08:52:52 GMT</pubDate>
    <dc:creator>SKK</dc:creator>
    <dc:date>2014-05-09T08:52:52Z</dc:date>
    <item>
      <title>Taking the earliest observation (by date) that fulfills a certain condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151677#M11867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a list of IDs with their respective measurement values and dates at which the measurement was taken (some IDs have multiple measurements). I then compute a new column ('Controlled') that is 1 when the value fulfills a condition (say, &amp;lt;50) and 0 otherwise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, what I want to do is to take only the earliest observation for each ID that fulfills a condition. Basically for each ID, if the value of the 'Controlled' column is 1, and there is more than 1 measurement that fits, I want to select the earliest observation (by date).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to do this in SAS EG via point and click? Or will I need to write a mini-program for it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 07:33:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151677#M11867</guid>
      <dc:creator>misaochan</dc:creator>
      <dc:date>2014-05-09T07:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: Taking the earliest observation (by date) that fulfills a certain condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151678#M11868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi in EG you can use the query builder to select and filter the data or u can try this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;Proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;sql&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;Create&lt;/SPAN&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; want &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; id, measurement, min(dates), controlled &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; have&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; controlled=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;group&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; id&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;having&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; count(*) gt &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Untested~&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 08:52:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151678#M11868</guid>
      <dc:creator>SKK</dc:creator>
      <dc:date>2014-05-09T08:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: Taking the earliest observation (by date) that fulfills a certain condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151679#M11869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the response! If I use the code, how do I 'connect' it to my dataset in EG? Create new program, then type that code in and link it to my dataset?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 09:17:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151679#M11869</guid>
      <dc:creator>misaochan</dc:creator>
      <dc:date>2014-05-09T09:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Taking the earliest observation (by date) that fulfills a certain condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151680#M11870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I hope u have ur dataset in EG library... Just upade ur dataset name in from clause and substitute all the variable... that should do it..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 09:29:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151680#M11870</guid>
      <dc:creator>SKK</dc:creator>
      <dc:date>2014-05-09T09:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: Taking the earliest observation (by date) that fulfills a certain condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151681#M11871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think that SK's code will work exactly right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't see a way to do it with Query Builder in one step, but you can do it in two.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, select ID and DATE; Add a filter of CONTROLLED = 1; For the Summary column, use a MIN on DATE; and ID should be automatically select as the grouping column&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you run this, it will return the ID/DATE combination of the earliest date for each ID, but you won't have a MEASUREMENT value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now create a new Query Builder task on this result; add your original dataset, and join on ID and DATE. The results should be what you want.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 14:06:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151681#M11871</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2014-05-09T14:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: Taking the earliest observation (by date) that fulfills a certain condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151682#M11872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is my try based on the mentioned requirements:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input id date date9. measurement;&lt;/P&gt;&lt;P&gt;format date date9.;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1 12-Aug-97 92&lt;/P&gt;&lt;P&gt;1 12-Aug-97 22&lt;/P&gt;&lt;P&gt;1 13-Aug-97 34&lt;/P&gt;&lt;P&gt;1 14-Aug-97 80&lt;/P&gt;&lt;P&gt;1 14-Aug-97 43&lt;/P&gt;&lt;P&gt;1 15-Aug-97 11&lt;/P&gt;&lt;P&gt;1 16-Aug-97 49&lt;/P&gt;&lt;P&gt;1 16-Aug-97 35&lt;/P&gt;&lt;P&gt;2 14-Aug-97 76&lt;/P&gt;&lt;P&gt;2 14-Aug-97 55&lt;/P&gt;&lt;P&gt;2 15-Aug-97 43&lt;/P&gt;&lt;P&gt;2 15-Aug-97 65&lt;/P&gt;&lt;P&gt;2 15-Aug-97 91&lt;/P&gt;&lt;P&gt;2 15-Aug-97 10&lt;/P&gt;&lt;P&gt;2 15-Aug-97 86&lt;/P&gt;&lt;P&gt;2 15-Aug-97 15&lt;/P&gt;&lt;P&gt;2 16-Aug-97 36&lt;/P&gt;&lt;P&gt;2 17-Aug-97 43&lt;/P&gt;&lt;P&gt;2 19-Aug-97 92&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select id,date,min(measurement) as measurement,&lt;/P&gt;&lt;P&gt;case when measurement&amp;lt;50 then 1 ELSE 0 END as controlled&lt;/P&gt;&lt;P&gt;from have&lt;/P&gt;&lt;P&gt;where calculated controlled=1&lt;/P&gt;&lt;P&gt;group by id,date,calculated controlled;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 17:09:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151682#M11872</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-05-09T17:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: Taking the earliest observation (by date) that fulfills a certain condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151683#M11873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the responses all. Unfortunately there is another issue that I need to solve before I try this, so I will have to work on that first (actually, am posting a thread about it too...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will come back and try this once I've solved that problem and have my dataset prepared properly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 May 2014 13:42:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151683#M11873</guid>
      <dc:creator>misaochan</dc:creator>
      <dc:date>2014-05-11T13:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Taking the earliest observation (by date) that fulfills a certain condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151684#M11874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sort the data by ID, and date in ascending order and apply&amp;nbsp; first.ID in data step.(after calculating the variable) You will get the required output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*creating the Controlled variable;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt; create table yourdata as select *,(case when measurement &amp;lt; 50 then 1 else 0 end) as controlled&lt;/P&gt;&lt;P&gt;&amp;nbsp; from yourdata &lt;/P&gt;&lt;P&gt;&amp;nbsp; having calculated controlled =1;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Sorting by ID and date (by default in ascending);&lt;/P&gt;&lt;P&gt;proc sort data=yourdata;&lt;/P&gt;&lt;P&gt;by ID date ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* Using First.ID to get the measurements on earliest date for each id;&lt;/P&gt;&lt;P&gt;data youwant;&lt;/P&gt;&lt;P&gt; set yourdata;&lt;/P&gt;&lt;P&gt; by ID date;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.ID ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2014 12:04:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Taking-the-earliest-observation-by-date-that-fulfills-a-certain/m-p/151684#M11874</guid>
      <dc:creator>Vish33</dc:creator>
      <dc:date>2014-05-12T12:04:04Z</dc:date>
    </item>
  </channel>
</rss>

