<?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 filter odd dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-filter-odd-dates/m-p/889022#M351209</link>
    <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;I need help for below scenario.&lt;/P&gt;&lt;P&gt;All dated will be in ascending order and if any date is smaller than its previous date then that is odd and need to be filter out.&lt;/P&gt;&lt;P&gt;I applied lag function but it is getting applied on entire variable not on group if 1 and 2 separately.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test1;&lt;BR /&gt;input id date$12.;&lt;BR /&gt;datalines;&lt;BR /&gt;1 01JAN2010&lt;BR /&gt;1 04JAN2010&lt;BR /&gt;1 08JAN2010&lt;BR /&gt;1 07JAN2010&lt;BR /&gt;1 11JAN2010&lt;BR /&gt;2 05JAN2010&lt;BR /&gt;2 06JAN2010&lt;BR /&gt;2 04JAN2010&lt;BR /&gt;2 07JAN2010&lt;BR /&gt;2 10JAN2010&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected output:&lt;/P&gt;&lt;P&gt;1 07JAN2010&lt;/P&gt;&lt;P&gt;2 04JAN2010&lt;/P&gt;</description>
    <pubDate>Sat, 12 Aug 2023 03:58:10 GMT</pubDate>
    <dc:creator>Ajayvit</dc:creator>
    <dc:date>2023-08-12T03:58:10Z</dc:date>
    <item>
      <title>How to filter odd dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-filter-odd-dates/m-p/889022#M351209</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;I need help for below scenario.&lt;/P&gt;&lt;P&gt;All dated will be in ascending order and if any date is smaller than its previous date then that is odd and need to be filter out.&lt;/P&gt;&lt;P&gt;I applied lag function but it is getting applied on entire variable not on group if 1 and 2 separately.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test1;&lt;BR /&gt;input id date$12.;&lt;BR /&gt;datalines;&lt;BR /&gt;1 01JAN2010&lt;BR /&gt;1 04JAN2010&lt;BR /&gt;1 08JAN2010&lt;BR /&gt;1 07JAN2010&lt;BR /&gt;1 11JAN2010&lt;BR /&gt;2 05JAN2010&lt;BR /&gt;2 06JAN2010&lt;BR /&gt;2 04JAN2010&lt;BR /&gt;2 07JAN2010&lt;BR /&gt;2 10JAN2010&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected output:&lt;/P&gt;&lt;P&gt;1 07JAN2010&lt;/P&gt;&lt;P&gt;2 04JAN2010&lt;/P&gt;</description>
      <pubDate>Sat, 12 Aug 2023 03:58:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-filter-odd-dates/m-p/889022#M351209</guid>
      <dc:creator>Ajayvit</dc:creator>
      <dc:date>2023-08-12T03:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter odd dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-filter-odd-dates/m-p/889025#M351211</link>
      <description>&lt;P&gt;Before doing anything else, convert the strings to SAS dates by using the INPUT function with the DATE9. informat.&lt;/P&gt;
&lt;P&gt;Then it's easy:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set test1;
by id;
if date lt lag(date) and not first.id;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 12 Aug 2023 07:02:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-filter-odd-dates/m-p/889025#M351211</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-08-12T07:02:28Z</dc:date>
    </item>
  </channel>
</rss>

