<?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: Looping in Enterprise Guide in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123662#M293973</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lets assume that you can sort it then. Working in EG:&lt;/P&gt;&lt;P&gt;Use a query step to :&lt;/P&gt;&lt;P&gt;1. calculate min of status&lt;/P&gt;&lt;P&gt;2. Calculate max of status&lt;/P&gt;&lt;P&gt;3. In having Clause check that min(status) ne max(status) . This makes sure your records have changed status and the only one isn't PC.&amp;nbsp; If you can have all DE and that be okay, change the logic to max(status)=min(status) and max(status) ne "PC"&amp;nbsp; &lt;/P&gt;&lt;P&gt;4. You can then use a data step as Tom has suggested to obtain the first (first. logic) or you can add some logic like the max(date1)=date1 to the query to have it select only one row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Sep 2013 21:45:34 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2013-09-03T21:45:34Z</dc:date>
    <item>
      <title>Looping in Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123651#M293962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm new to SAS .. We have a requirement to compare each row in a table based on a key column and select a based on business rules. I want to know if we have a way to loop through all the rows in a table using Enterprise Guide tool. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls advice or point me in a right direction&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2013 21:33:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123651#M293962</guid>
      <dc:creator>Jackme</dc:creator>
      <dc:date>2013-08-27T21:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123652#M293963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think you need a loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Provide some more details. It sounds more like a merge and some criteria, which can probably be done in the filter and query tool.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2013 21:37:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123652#M293963</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-08-27T21:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123653#M293964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Reeza ..Here is the data for me &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C5&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; C6&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DE&amp;nbsp;&amp;nbsp;&amp;nbsp; test&amp;nbsp;&amp;nbsp;&amp;nbsp; me&amp;nbsp;&amp;nbsp;&amp;nbsp; jan-01-02&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jan-01-02&lt;/P&gt;&lt;P&gt;00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DE&amp;nbsp;&amp;nbsp;&amp;nbsp; test2&amp;nbsp;&amp;nbsp; me&amp;nbsp;&amp;nbsp;&amp;nbsp; jan-01-03&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jan-01-02&lt;/P&gt;&lt;P&gt;00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DE&amp;nbsp;&amp;nbsp;&amp;nbsp; test3&amp;nbsp;&amp;nbsp;&amp;nbsp; me&amp;nbsp;&amp;nbsp; jan-01-04&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jan-01-02&lt;/P&gt;&lt;P&gt;00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PC&amp;nbsp;&amp;nbsp;&amp;nbsp; test3&amp;nbsp;&amp;nbsp;&amp;nbsp; me&amp;nbsp;&amp;nbsp; jan-01-04&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jan-01-02&lt;/P&gt;&lt;P&gt;00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FR&amp;nbsp;&amp;nbsp;&amp;nbsp; test3&amp;nbsp;&amp;nbsp;&amp;nbsp; me&amp;nbsp;&amp;nbsp; jan-01-05&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jan-01-02&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With this data i want to get only last row which is&amp;nbsp; - 00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FR&amp;nbsp;&amp;nbsp;&amp;nbsp; test3&amp;nbsp;&amp;nbsp;&amp;nbsp; me&amp;nbsp;&amp;nbsp; jan-01-05&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jan-01-02 ..it's not guarentee that it will FR in C2 ..there could be any value..business rule is to take the max DE row if exists from there exclude any PC rows and go to next row to find the date in column C5..pls advice on this...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2013 21:47:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123653#M293964</guid>
      <dc:creator>Jackme</dc:creator>
      <dc:date>2013-08-27T21:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123654#M293965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Generally a good way to ask the question is to put a table that shows what your data looks like and what the output is.&lt;/P&gt;&lt;P&gt;I'd recommend posting some more examples that meet all your requirements and include what you want the final output to look like as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is not a loop problem in SAS terminology.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2013 21:56:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123654#M293965</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-08-27T21:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123655#M293966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 1068px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="63"&gt;ID&lt;/TD&gt;&lt;TD width="49"&gt;ID1&lt;/TD&gt;&lt;TD width="40"&gt;Satus&lt;/TD&gt;&lt;TD width="49"&gt;ID2&lt;/TD&gt;&lt;TD width="115"&gt;Date1&lt;/TD&gt;&lt;TD width="114"&gt;Date2&lt;/TD&gt;&lt;TD width="75"&gt;Date3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="20"&gt;1234&lt;/TD&gt;&lt;TD class="xl69"&gt;15115&lt;/TD&gt;&lt;TD class="xl69"&gt;EX&lt;/TD&gt;&lt;TD class="xl69"&gt;1444&lt;/TD&gt;&lt;TD align="right" class="xl70"&gt;4/10/10 11:06 AM&lt;/TD&gt;&lt;TD align="right" class="xl70"&gt;2/5/13 1:51 PM&lt;/TD&gt;&lt;TD align="right" class="xl71"&gt;4/11/2010&lt;/TD&gt;&lt;TD&gt;I want this row for this ID , ID1, ID2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="20"&gt;1234&lt;/TD&gt;&lt;TD class="xl63"&gt;15115&lt;/TD&gt;&lt;TD class="xl63"&gt;DE&lt;/TD&gt;&lt;TD class="xl63"&gt;1444&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;4/10/10 11:06 AM&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;2/5/13 1:30 PM&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;4/11/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="20"&gt;1234&lt;/TD&gt;&lt;TD class="xl63"&gt;15115&lt;/TD&gt;&lt;TD class="xl63"&gt;DE&lt;/TD&gt;&lt;TD class="xl63"&gt;1444&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;4/10/10 11:06 AM&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;4/10/10 11:06 AM&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;4/11/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl72" height="20"&gt;2345&lt;/TD&gt;&lt;TD class="xl72"&gt;16330&lt;/TD&gt;&lt;TD class="xl72"&gt;EX&lt;/TD&gt;&lt;TD class="xl72"&gt;1436&lt;/TD&gt;&lt;TD align="right" class="xl73"&gt;4/10/10 10:09 AM&lt;/TD&gt;&lt;TD align="right" class="xl73"&gt;2/5/13 2:15 PM&lt;/TD&gt;&lt;TD align="right" class="xl74"&gt;4/11/2010&lt;/TD&gt;&lt;TD&gt;I want this row for this ID , ID1, ID2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl72" height="20"&gt;2345&lt;/TD&gt;&lt;TD class="xl63"&gt;16330&lt;/TD&gt;&lt;TD class="xl63"&gt;DE&lt;/TD&gt;&lt;TD class="xl63"&gt;1436&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;4/10/10 10:09 AM&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;2/5/13 2:04 PM&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;4/11/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl72" height="20"&gt;2345&lt;/TD&gt;&lt;TD class="xl63"&gt;16330&lt;/TD&gt;&lt;TD class="xl63"&gt;DE&lt;/TD&gt;&lt;TD class="xl63"&gt;1436&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;4/10/10 10:09 AM&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;4/10/10 10:09 AM&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;4/11/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;5678&lt;/TD&gt;&lt;TD class="xl66"&gt;26856&lt;/TD&gt;&lt;TD class="xl66"&gt;DE&lt;/TD&gt;&lt;TD class="xl66"&gt;5482&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;6/24/10 9:53 AM&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;2/27/13 12:36 PM&lt;/TD&gt;&lt;TD align="right" class="xl68"&gt;8/1/2010&lt;/TD&gt;&lt;TD&gt;I want to ingore this for because it only DE status there is no other status later&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;5678&lt;/TD&gt;&lt;TD class="xl66"&gt;26856&lt;/TD&gt;&lt;TD class="xl66"&gt;DE&lt;/TD&gt;&lt;TD class="xl66"&gt;5482&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;6/24/10 9:53 AM&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;6/24/10 9:53 AM&lt;/TD&gt;&lt;TD align="right" class="xl68"&gt;8/1/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl72" height="20"&gt;7890&lt;/TD&gt;&lt;TD class="xl72"&gt;32684&lt;/TD&gt;&lt;TD class="xl72"&gt;EX&lt;/TD&gt;&lt;TD class="xl72"&gt;9373&lt;/TD&gt;&lt;TD align="right" class="xl73"&gt;1/28/13 1:18 PM&lt;/TD&gt;&lt;TD align="right" class="xl73"&gt;2/8/13 4:06 PM&lt;/TD&gt;&lt;TD align="right" class="xl74"&gt;9/13/2010&lt;/TD&gt;&lt;TD&gt;I want this row for this ID , ID1, ID2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl72" height="20"&gt;7890&lt;/TD&gt;&lt;TD class="xl63"&gt;32684&lt;/TD&gt;&lt;TD class="xl63"&gt;PC&lt;/TD&gt;&lt;TD class="xl63"&gt;9373&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;1/28/13 1:18 PM&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;2/6/13 8:33 AM&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;9/13/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl72" height="20"&gt;7890&lt;/TD&gt;&lt;TD class="xl63"&gt;32684&lt;/TD&gt;&lt;TD class="xl63"&gt;DE&lt;/TD&gt;&lt;TD class="xl63"&gt;9373&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;1/28/13 1:18 PM&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;2/5/13 1:15 PM&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;9/13/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl72" height="20"&gt;7890&lt;/TD&gt;&lt;TD class="xl63"&gt;32684&lt;/TD&gt;&lt;TD class="xl63"&gt;DE&lt;/TD&gt;&lt;TD class="xl63"&gt;9373&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;1/28/13 1:18 PM&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;1/28/13 1:18 PM&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;9/13/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1003&lt;/TD&gt;&lt;TD class="xl66"&gt;35196&lt;/TD&gt;&lt;TD class="xl66"&gt;PC&lt;/TD&gt;&lt;TD class="xl66"&gt;0756&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;9/17/10 2:12 PM&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;2/4/13 12:30 PM&lt;/TD&gt;&lt;TD align="right" class="xl68"&gt;10/10/2010&lt;/TD&gt;&lt;TD&gt;I want to ingore this for because it only PC as a top of stack based on Date2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1003&lt;/TD&gt;&lt;TD class="xl66"&gt;35196&lt;/TD&gt;&lt;TD class="xl66"&gt;DE&lt;/TD&gt;&lt;TD class="xl66"&gt;0756&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;9/17/10 2:12 PM&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;9/17/10 2:15 PM&lt;/TD&gt;&lt;TD align="right" class="xl68"&gt;10/10/2010&lt;/TD&gt;&lt;TD&gt;I want to ingore this for because it only PC as a top of stack based on Date3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;1003&lt;/TD&gt;&lt;TD class="xl66"&gt;35196&lt;/TD&gt;&lt;TD class="xl66"&gt;DE&lt;/TD&gt;&lt;TD class="xl66"&gt;0756&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;9/17/10 2:12 PM&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;9/17/10 2:12 PM&lt;/TD&gt;&lt;TD align="right" class="xl68"&gt;10/10/2010&lt;/TD&gt;&lt;TD&gt;I want to ingore this for because it only PC as a top of stack based on Date4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;7538&lt;/TD&gt;&lt;TD class="xl66"&gt;35230&lt;/TD&gt;&lt;TD class="xl66"&gt;PC&lt;/TD&gt;&lt;TD class="xl66"&gt;8188&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;8/9/10 12:03 PM&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;2/4/13 10:30 AM&lt;/TD&gt;&lt;TD align="right" class="xl68"&gt;8/1/2010&lt;/TD&gt;&lt;TD&gt;I want to ingore this for because it only PC as a top of stack based on Date5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;7538&lt;/TD&gt;&lt;TD class="xl66"&gt;35230&lt;/TD&gt;&lt;TD class="xl66"&gt;DE&lt;/TD&gt;&lt;TD class="xl66"&gt;8188&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;8/9/10 12:03 PM&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;8/9/10 12:03 PM&lt;/TD&gt;&lt;TD align="right" class="xl68"&gt;8/1/2010&lt;/TD&gt;&lt;TD&gt;I want to ingore this for because it only PC as a top of stack based on Date6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl72" height="20"&gt;5135&lt;/TD&gt;&lt;TD class="xl72"&gt;44478&lt;/TD&gt;&lt;TD class="xl72"&gt;EX&lt;/TD&gt;&lt;TD class="xl72"&gt;1106&lt;/TD&gt;&lt;TD align="right" class="xl73"&gt;3/3/11 12:18 PM&lt;/TD&gt;&lt;TD align="right" class="xl73"&gt;2/11/13 3:45 PM&lt;/TD&gt;&lt;TD align="right" class="xl74"&gt;6/20/2011&lt;/TD&gt;&lt;TD&gt;I want this row for this ID , ID1, ID2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl72" height="20"&gt;5135&lt;/TD&gt;&lt;TD class="xl63"&gt;44478&lt;/TD&gt;&lt;TD class="xl63"&gt;DE&lt;/TD&gt;&lt;TD class="xl63"&gt;1106&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;3/3/11 12:18 PM&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;6/20/11 5:02 AM&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;6/20/2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl72" height="20"&gt;5135&lt;/TD&gt;&lt;TD class="xl63"&gt;44478&lt;/TD&gt;&lt;TD class="xl63"&gt;PM&lt;/TD&gt;&lt;TD class="xl63"&gt;1106&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;3/3/11 12:18 PM&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;3/3/11 12:18 PM&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;6/20/2011&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the sample data ..pls check do let me know if we can compare each row based on key columns in EGuide.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Aug 2013 20:16:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123655#M293966</guid>
      <dc:creator>Jackme</dc:creator>
      <dc:date>2013-08-29T20:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123656#M293967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Team - Any ideas how we can do this using EGuide or with some programming in EGuide&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Sep 2013 18:57:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123656#M293967</guid>
      <dc:creator>Jackme</dc:creator>
      <dc:date>2013-09-03T18:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123657#M293968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think you've explained your logic clearly enough...at least for me it would take a while to try and guess at it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Sep 2013 19:04:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123657#M293968</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-09-03T19:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123658#M293969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for checking. Pls do let me know if you need more details or info .. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Sep 2013 20:10:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123658#M293969</guid>
      <dc:creator>Jackme</dc:creator>
      <dc:date>2013-09-03T20:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123659#M293970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;More details.&amp;nbsp; See here: &lt;A __default_attr="2263" __jive_macro_name="document" class="jive_macro jive_macro_document active_link" href="https://communities.sas.com/" modifiedtitle="true" title="How to ask a question in SAS Support Communities?"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example what about records where you have no indicator beside it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, What uniquely identifies a group, is it ID, ID2, ID3 or are the dates important? If the dates are important are the times?&amp;nbsp; &lt;/P&gt;&lt;P&gt;Please take the time to detail your question if you expect a detailed response. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Sep 2013 21:30:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123659#M293970</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-09-03T21:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123660#M293971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I sounds like you want to group your data by ID, ID1, ID2, DATE1.&lt;/P&gt;&lt;P&gt;Then you want to sort by DATE2.&lt;/P&gt;&lt;P&gt;If the last (latest) record has status = 'PC' the remove all for that group.&lt;/P&gt;&lt;P&gt;Otherwise keep only the last (latest) record.&lt;/P&gt;&lt;P&gt;These two requirements reduce to keep only the latest record and deleting it if the status is 'PC'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=HAVE&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by id id1 id2 date1 date2 ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt; set HAVE ;&lt;/P&gt;&lt;P&gt; by id id1 id2 date1 date2 ;&lt;/P&gt;&lt;P&gt; if last.date1 ;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; if status='PC' then delete ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Sep 2013 21:33:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123660#M293971</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-09-03T21:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123661#M293972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your time and help tips. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes ID,ID1,ID2 are key columns.With below sample data I want to compare data for ID,ID1,ID2 in each row ..Example for ID 1234 we have Satus DE,DE and EX rows..for this combination take max DE row and after that row find next EX row ..in this case this is the row which I want in my output file &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="border: 0px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;TBODY style="font-style: inherit; font-family: inherit;"&gt;&lt;TR style="border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;TD class="xl69" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1234&lt;/TD&gt;&lt;TD class="xl69" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;15115&lt;/TD&gt;&lt;TD class="xl69" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;EX&lt;/TD&gt;&lt;TD class="xl69" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1444&lt;/TD&gt;&lt;TD align="right" class="xl70" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4/10/10 11:06 AM&lt;/TD&gt;&lt;TD align="right" class="xl70" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;2/5/13 1:51 PM&lt;/TD&gt;&lt;TD align="right" class="xl71" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4/11/2010&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;I want this row for this ID , ID1, ID2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this is clear to some extent to give some idea on how we can do it..&lt;/P&gt;&lt;P&gt;Sample Data...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="border: 0px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;TBODY style="font-style: inherit; font-family: inherit;"&gt;&lt;TR style="border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;TD height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;" width="63"&gt;ID&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;" width="49"&gt;ID1&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;" width="40"&gt;Satus&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;" width="49"&gt;ID2&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;" width="115"&gt;Date1&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;" width="114"&gt;Date2&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;" width="75"&gt;Date3&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;TD class="xl69" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1234&lt;/TD&gt;&lt;TD class="xl69" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;15115&lt;/TD&gt;&lt;TD class="xl69" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;EX&lt;/TD&gt;&lt;TD class="xl69" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1444&lt;/TD&gt;&lt;TD align="right" class="xl70" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4/10/10 11:06 AM&lt;/TD&gt;&lt;TD align="right" class="xl70" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;2/5/13 1:51 PM&lt;/TD&gt;&lt;TD align="right" class="xl71" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4/11/2010&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;I want this row for this ID , ID1, ID2&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;TD class="xl69" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1234&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;15115&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;DE&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1444&lt;/TD&gt;&lt;TD align="right" class="xl65" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4/10/10 11:06 AM&lt;/TD&gt;&lt;TD align="right" class="xl65" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;2/5/13 1:30 PM&lt;/TD&gt;&lt;TD align="right" class="xl64" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4/11/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;TD class="xl69" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1234&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;15115&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;DE&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1444&lt;/TD&gt;&lt;TD align="right" class="xl65" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4/10/10 11:06 AM&lt;/TD&gt;&lt;TD align="right" class="xl65" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4/10/10 11:06 AM&lt;/TD&gt;&lt;TD align="right" class="xl64" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4/11/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;TD class="xl72" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;2345&lt;/TD&gt;&lt;TD class="xl72" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;16330&lt;/TD&gt;&lt;TD class="xl72" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;EX&lt;/TD&gt;&lt;TD class="xl72" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1436&lt;/TD&gt;&lt;TD align="right" class="xl73" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4/10/10 10:09 AM&lt;/TD&gt;&lt;TD align="right" class="xl73" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;2/5/13 2:15 PM&lt;/TD&gt;&lt;TD align="right" class="xl74" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4/11/2010&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;I want this row for this ID , ID1, ID2&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;TD class="xl72" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;2345&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;16330&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;DE&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1436&lt;/TD&gt;&lt;TD align="right" class="xl65" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4/10/10 10:09 AM&lt;/TD&gt;&lt;TD align="right" class="xl65" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;2/5/13 2:04 PM&lt;/TD&gt;&lt;TD align="right" class="xl64" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4/11/2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;TD class="xl72" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;2345&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;16330&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;DE&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1436&lt;/TD&gt;&lt;TD align="right" class="xl65" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4/10/10 10:09 AM&lt;/TD&gt;&lt;TD align="right" class="xl65" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4/10/10 10:09 AM&lt;/TD&gt;&lt;TD align="right" class="xl64" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4/11/2010&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Sep 2013 21:39:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123661#M293972</guid>
      <dc:creator>Jackme</dc:creator>
      <dc:date>2013-09-03T21:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123662#M293973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lets assume that you can sort it then. Working in EG:&lt;/P&gt;&lt;P&gt;Use a query step to :&lt;/P&gt;&lt;P&gt;1. calculate min of status&lt;/P&gt;&lt;P&gt;2. Calculate max of status&lt;/P&gt;&lt;P&gt;3. In having Clause check that min(status) ne max(status) . This makes sure your records have changed status and the only one isn't PC.&amp;nbsp; If you can have all DE and that be okay, change the logic to max(status)=min(status) and max(status) ne "PC"&amp;nbsp; &lt;/P&gt;&lt;P&gt;4. You can then use a data step as Tom has suggested to obtain the first (first. logic) or you can add some logic like the max(date1)=date1 to the query to have it select only one row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Sep 2013 21:45:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123662#M293973</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-09-03T21:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123663#M293974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Reeza and Tom . I'm trying to implement the solutions in EG . There is some success . I will update the team once I reach my target data set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Sep 2013 23:50:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123663#M293974</guid>
      <dc:creator>Jackme</dc:creator>
      <dc:date>2013-09-03T23:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123664#M293975</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;this helps you get what you want...&lt;/P&gt;&lt;P&gt;Assume that toto is your initial dataset&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=toto out=titi;&lt;/P&gt;&lt;P&gt; by id id1 id2 date1 date2 status;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data tata;&lt;/P&gt;&lt;P&gt; set titi;&lt;/P&gt;&lt;P&gt; by id id1 id2 date1 date2 status;&lt;/P&gt;&lt;P&gt; if last.date1;&lt;/P&gt;&lt;P&gt; if status in ('PC', 'DE') then delete;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Sep 2013 08:27:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-in-Enterprise-Guide/m-p/123664#M293975</guid>
      <dc:creator>fbatch</dc:creator>
      <dc:date>2013-09-05T08:27:05Z</dc:date>
    </item>
  </channel>
</rss>

