<?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 How to compare dates with the next row and exclude rows based on the criteria? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-compare-dates-with-the-next-row-and-exclude-rows-based-on/m-p/638834#M21617</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'll start by providing the requirement:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT color="#0000ff"&gt;Blue highlighted dates&lt;/FONT&gt; are the expected results&lt;/LI&gt;&lt;LI&gt;DAYS_DIFF = 1st DISCH_DT - NEXT ADMIT_DT&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Apr 2020 23:28:57 GMT</pubDate>
    <dc:creator>mrafael03</dc:creator>
    <dc:date>2020-04-09T23:28:57Z</dc:date>
    <item>
      <title>How to compare dates with the next row and exclude rows based on the criteria?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-compare-dates-with-the-next-row-and-exclude-rows-based-on/m-p/638834#M21617</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'll start by providing the requirement:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT color="#0000ff"&gt;Blue highlighted dates&lt;/FONT&gt; are the expected results&lt;/LI&gt;&lt;LI&gt;DAYS_DIFF = 1st DISCH_DT - NEXT ADMIT_DT&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 23:28:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-compare-dates-with-the-next-row-and-exclude-rows-based-on/m-p/638834#M21617</guid>
      <dc:creator>mrafael03</dc:creator>
      <dc:date>2020-04-09T23:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare dates with the next row and exclude rows based on the criteria?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-compare-dates-with-the-next-row-and-exclude-rows-based-on/m-p/638835#M21618</link>
      <description>&lt;P&gt;&lt;STRONG&gt;CONTINUATION...&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. If the discharge is followed by readmission or direct transfer to an acute inpatient care setting within 30-day follow-up period, count only the last discharge.&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADMIT_DT&amp;nbsp;&amp;nbsp; DISCH_DT&amp;nbsp;&amp;nbsp; DAYS_DIFF&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRIKE&gt;011&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/10/2018&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/13/2018&lt;/STRIKE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color="#ff0000"&gt;16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt; &amp;lt;&amp;lt;&amp;lt; "readmission within 30 days - only include last discharge"&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;011&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/29/2018&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/28/2018&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;022&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/13/2018&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/17/2018&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color="#ff0000"&gt;55&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt; &amp;lt;&amp;lt;&amp;lt; "readmission &amp;gt;30 days"&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;022&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/13/2018&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/25/2018&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;2. For member with same admission date, but different discharge dates; use the last discharge date.&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp; ADMIT_DT&amp;nbsp;&amp;nbsp; DISCH_DT&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRIKE&gt;033&amp;nbsp;&amp;nbsp; 5/11/2018&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/12/2018&lt;/STRIKE&gt;&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;033&amp;nbsp;&amp;nbsp; 5/11/2018&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/17/2018&amp;nbsp;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. For member with same discharge date, but different admit date; use the first admit date.&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp; ADMIT_DT&amp;nbsp;&amp;nbsp; DISCH_DT&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;033&amp;nbsp; 6/11/2018&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color="#0000ff"&gt;6/17/2018&lt;/FONT&gt;&lt;BR /&gt;&lt;STRIKE&gt;033&amp;nbsp; 6/13/2018&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6/17/2018&lt;/STRIKE&gt;&lt;/P&gt;&lt;P&gt;4. For member with the same 1st discharge date and next admit date, count the 1st admit date and next discharge date.&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADMIT_DT&amp;nbsp;&amp;nbsp; DISCH_DT&amp;nbsp; DAYS_DIFF&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;033&amp;nbsp; 08/11/2018&amp;nbsp;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp; &lt;STRIKE&gt;08/17/2018&lt;/STRIKE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color="#ff0000"&gt; 0&lt;/FONT&gt;&lt;BR /&gt;&lt;STRIKE&gt;033&amp;nbsp; 08/17/2018&amp;nbsp;&lt;/STRIKE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color="#0000ff"&gt;08/23/2018&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to loop through the dataset by using RETAIN STATEMENT. See the attachment for my SAS codes. I'm still a newbie in SAS and trying to figure out on how to retain/remove rows&amp;nbsp; based on the criteria. Any help would be greatly appreciated. Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 23:37:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-compare-dates-with-the-next-row-and-exclude-rows-based-on/m-p/638835#M21618</guid>
      <dc:creator>mrafael03</dc:creator>
      <dc:date>2020-04-09T23:37:47Z</dc:date>
    </item>
  </channel>
</rss>

