<?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: How to filter observation from month to another month? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-filter-observation-from-month-to-another-month/m-p/509039#M136784</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to manipulate date, you should first convert your string dates into date format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input strdate $;
format date mmddyy10.;
date=input(strdate,anydtdte.);
put date;
cards;
01/2018
02/2018
03/2018
04/2018
05/2018
06/2018
07/2018
08/2018
09/2018
10/2018
;
run;

proc sql;
SELECT * FROM have
WHERE date BETWEEN '01Aug2018'd AND '01Sep2018'd;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 31 Oct 2018 09:41:20 GMT</pubDate>
    <dc:creator>gamotte</dc:creator>
    <dc:date>2018-10-31T09:41:20Z</dc:date>
    <item>
      <title>How to filter observation from month to another month?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-filter-observation-from-month-to-another-month/m-p/508997#M136766</link>
      <description>&lt;P&gt;Dear experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to filter observation for latest 3 months with the condition in variable "Report_Month", I did manage to filter for currently month (October) with the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Where REPORT_MONTH = PUT(DATE(),MMYYS10.);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Would you mind instructing us, how can I filter the observations from a period (let say AUG/2018 to OCT/2018) ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Notes: the value format of the variable looks like &lt;SPAN&gt;"08/2018"&lt;/SPAN&gt;, &lt;SPAN&gt;"09/2018"&lt;/SPAN&gt;,"10/2018", etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your helping.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 04:03:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-filter-observation-from-month-to-another-month/m-p/508997#M136766</guid>
      <dc:creator>Tri_Luong</dc:creator>
      <dc:date>2018-10-31T04:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter observation from month to another month?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-filter-observation-from-month-to-another-month/m-p/509037#M136782</link>
      <description>&lt;P&gt;i will use month and intnx functions to solve this. something like below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;&lt;BR /&gt;date = '09Oct2018'D;&lt;BR /&gt;output;&lt;BR /&gt;date = '09Oct2018'D;&lt;BR /&gt;output;&lt;BR /&gt;date = '09SEP2018'D;&lt;BR /&gt;output;&lt;BR /&gt;date = '09AUG2018'D;&lt;BR /&gt;output;&lt;BR /&gt;date = '05AUG2018'D;&lt;BR /&gt;output;&lt;BR /&gt;date = '09JUN2018'D;&lt;BR /&gt;output;&lt;BR /&gt;format date date9.;; &lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;where month(date) le month(today())&lt;BR /&gt;and month(date) ge month(intnx('month', today(), -2)) ;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 09:34:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-filter-observation-from-month-to-another-month/m-p/509037#M136782</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-10-31T09:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter observation from month to another month?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-filter-observation-from-month-to-another-month/m-p/509039#M136784</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to manipulate date, you should first convert your string dates into date format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input strdate $;
format date mmddyy10.;
date=input(strdate,anydtdte.);
put date;
cards;
01/2018
02/2018
03/2018
04/2018
05/2018
06/2018
07/2018
08/2018
09/2018
10/2018
;
run;

proc sql;
SELECT * FROM have
WHERE date BETWEEN '01Aug2018'd AND '01Sep2018'd;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Oct 2018 09:41:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-filter-observation-from-month-to-another-month/m-p/509039#M136784</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-10-31T09:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter observation from month to another month?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-filter-observation-from-month-to-another-month/m-p/509046#M136786</link>
      <description>&lt;P&gt;Alternatively,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;where input(substr(put(date,date9.),3),monyy7.) &amp;lt;= input(substr(put(today(),date9.),3),monyy7.) &amp;lt;= input(substr(put(date,date9.),3),monyy7.) ;&lt;BR /&gt;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 10:29:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-filter-observation-from-month-to-another-month/m-p/509046#M136786</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2018-10-31T10:29:52Z</dc:date>
    </item>
  </channel>
</rss>

