<?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: return 2nd to the last observation for each id when a condition is not met in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/return-2nd-to-the-last-observation-for-each-id-when-a-condition/m-p/624612#M20132</link>
    <description>&lt;P&gt;Sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; &amp;lt; or &amp;lt;= ? /*&amp;nbsp;&lt;SPAN&gt;date range is le 12/31/2017*/&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Feb 2020 19:46:10 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2020-02-13T19:46:10Z</dc:date>
    <item>
      <title>return 2nd to the last observation for each id when a condition is not met</title>
      <link>https://communities.sas.com/t5/New-SAS-User/return-2nd-to-the-last-observation-for-each-id-when-a-condition/m-p/624608#M20130</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello, how do I return the second to the last observation when a condition is not met? I am using the last function to return observations that are within a certain date range. When the observation is not in a particular date range I want the record before it to be returned.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here' an example. I want the &lt;A href="http://last.id/" target="_blank" rel="noopener"&gt;last.id&lt;/A&gt; to be returned if the date range is le 12/31/2017 when this condition is not met i want it to return the 2nd to the last record for each id&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ID&amp;nbsp; &amp;nbsp;DATE &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1&amp;nbsp; &amp;nbsp;12/1/2016 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1&amp;nbsp; &amp;nbsp;11/3/2017 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1&amp;nbsp; &amp;nbsp;12/8/2019 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2&amp;nbsp; &amp;nbsp;12/1/2017&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2&amp;nbsp; &amp;nbsp;12/30/2017 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3&amp;nbsp; &amp;nbsp;12/1/2017&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;so ideally these records would be returned&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ID&amp;nbsp; &amp;nbsp;DATE &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1&amp;nbsp; &amp;nbsp; 11/3/2017 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2&amp;nbsp; &amp;nbsp; 12/30/2017 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3&amp;nbsp; &amp;nbsp; 12/1/2017&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 19:33:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/return-2nd-to-the-last-observation-for-each-id-when-a-condition/m-p/624608#M20130</guid>
      <dc:creator>Tiffany1217</dc:creator>
      <dc:date>2020-02-13T19:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: return 2nd to the last observation for each id when a condition is not met</title>
      <link>https://communities.sas.com/t5/New-SAS-User/return-2nd-to-the-last-observation-for-each-id-when-a-condition/m-p/624610#M20131</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have(where=(date&amp;lt;'31DEC17'd));
   by id;
   if last.id;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Feb 2020 19:41:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/return-2nd-to-the-last-observation-for-each-id-when-a-condition/m-p/624610#M20131</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-13T19:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: return 2nd to the last observation for each id when a condition is not met</title>
      <link>https://communities.sas.com/t5/New-SAS-User/return-2nd-to-the-last-observation-for-each-id-when-a-condition/m-p/624612#M20132</link>
      <description>&lt;P&gt;Sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; &amp;lt; or &amp;lt;= ? /*&amp;nbsp;&lt;SPAN&gt;date range is le 12/31/2017*/&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 19:46:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/return-2nd-to-the-last-observation-for-each-id-when-a-condition/m-p/624612#M20132</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-02-13T19:46:10Z</dc:date>
    </item>
  </channel>
</rss>

