<?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: filtering out date in sas using where statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/filtering-out-date-in-sas-using-where-statement/m-p/781890#M249208</link>
    <description>Thanks.&lt;BR /&gt;&lt;BR /&gt;This is giving me syntax error&lt;BR /&gt;&lt;BR /&gt;data new_del;&lt;BR /&gt;set test1;&lt;BR /&gt;where "01JUL2018"d ge invoice_dt le "31JUL2018"d and "01Mar2019"d ge invoice_dt  le "31Mar2019"d  delete ;&lt;BR /&gt;</description>
    <pubDate>Tue, 23 Nov 2021 09:08:35 GMT</pubDate>
    <dc:creator>Aexor</dc:creator>
    <dc:date>2021-11-23T09:08:35Z</dc:date>
    <item>
      <title>filtering out date in sas using where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filtering-out-date-in-sas-using-where-statement/m-p/781885#M249206</link>
      <description>&lt;P&gt;I have a sample data like this:&lt;/P&gt;
&lt;P&gt;Here invoice_dt is in format&amp;nbsp;DDMMYYS10.;&lt;/P&gt;
&lt;P&gt;Sale&amp;nbsp; &amp;nbsp;invoice_dt&lt;/P&gt;
&lt;P&gt;A&amp;nbsp; &amp;nbsp; &amp;nbsp; 23/07/2018&lt;/P&gt;
&lt;P&gt;B&amp;nbsp; &amp;nbsp; &amp;nbsp; 01/07/2018&lt;/P&gt;
&lt;P&gt;C&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;22/07/2018&lt;/P&gt;
&lt;P&gt;D&amp;nbsp; &amp;nbsp; &amp;nbsp; 04/03/2019&lt;/P&gt;
&lt;P&gt;E&amp;nbsp; &amp;nbsp; &amp;nbsp; 31/03/2019&lt;/P&gt;
&lt;P&gt;R&amp;nbsp; &amp;nbsp; &amp;nbsp; 31/07/2018&lt;/P&gt;
&lt;P&gt;F&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 01/05/2018&lt;/P&gt;
&lt;P&gt;I&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;10/07/2015&lt;/P&gt;
&lt;P&gt;J&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;01/02/2014&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to write a where condition in datastep to delete records&amp;nbsp; where invoice_dt is in between&amp;nbsp; 01/07/2018 to 31/07/2018 and 01/03/2019 to 31/03/2019,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 08:34:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filtering-out-date-in-sas-using-where-statement/m-p/781885#M249206</guid>
      <dc:creator>Aexor</dc:creator>
      <dc:date>2021-11-23T08:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: filtering out date in sas using where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filtering-out-date-in-sas-using-where-statement/m-p/781887#M249207</link>
      <description>&lt;P&gt;Date literals are specified in SAS in the form "ddmonyyyy"d, like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;"23nov2021"d&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So you can use a condition like&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;"01jul2018"d le invoice_dt le "31jul2018"d&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and combine multiple such conditions with OR&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 08:49:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filtering-out-date-in-sas-using-where-statement/m-p/781887#M249207</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-23T08:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: filtering out date in sas using where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filtering-out-date-in-sas-using-where-statement/m-p/781890#M249208</link>
      <description>Thanks.&lt;BR /&gt;&lt;BR /&gt;This is giving me syntax error&lt;BR /&gt;&lt;BR /&gt;data new_del;&lt;BR /&gt;set test1;&lt;BR /&gt;where "01JUL2018"d ge invoice_dt le "31JUL2018"d and "01Mar2019"d ge invoice_dt  le "31Mar2019"d  delete ;&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Nov 2021 09:08:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filtering-out-date-in-sas-using-where-statement/m-p/781890#M249208</guid>
      <dc:creator>Aexor</dc:creator>
      <dc:date>2021-11-23T09:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: filtering out date in sas using where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filtering-out-date-in-sas-using-where-statement/m-p/781891#M249209</link>
      <description>&lt;P&gt;Just look at the position of the marker in the log.&lt;/P&gt;
&lt;P&gt;DELETE is a data step statement, not an option used in other statements.&lt;/P&gt;
&lt;P&gt;Since you want to filter out observations, negate the conditions&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where not ("firstdate"d le date le "lastdate"d) and not ("otherfirstdate"d le date le "otherlastdate"d);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you have further trouble, post the &lt;EM&gt;complete&lt;/EM&gt; log of the step into a window opened with this button:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54552i914D97BE1B0F21E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 09:14:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filtering-out-date-in-sas-using-where-statement/m-p/781891#M249209</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-23T09:14:45Z</dc:date>
    </item>
  </channel>
</rss>

