<?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 Filter last month in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filter-last-month/m-p/444929#M28771</link>
    <description>Hi! I'm trying to filter a data set that contains information from 2010 until yesterday. However, the goal here is to filter only data from the last month, i.e., suppose i have transactions from 10jan2018:18:29:45 to 11mar2018:14:23:39, and i only need those from 01feb2018:0:0:0 to 01mar2018:0:0:0. How can I do this? Notice I already used prompts but since this is going to be an automatic report, i need to have it hard coded without waiting for a user response in the middle of the project. Any help will be much appreciated!</description>
    <pubDate>Mon, 12 Mar 2018 20:26:56 GMT</pubDate>
    <dc:creator>GuillermoPH</dc:creator>
    <dc:date>2018-03-12T20:26:56Z</dc:date>
    <item>
      <title>Filter last month</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filter-last-month/m-p/444929#M28771</link>
      <description>Hi! I'm trying to filter a data set that contains information from 2010 until yesterday. However, the goal here is to filter only data from the last month, i.e., suppose i have transactions from 10jan2018:18:29:45 to 11mar2018:14:23:39, and i only need those from 01feb2018:0:0:0 to 01mar2018:0:0:0. How can I do this? Notice I already used prompts but since this is going to be an automatic report, i need to have it hard coded without waiting for a user response in the middle of the project. Any help will be much appreciated!</description>
      <pubDate>Mon, 12 Mar 2018 20:26:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filter-last-month/m-p/444929#M28771</guid>
      <dc:creator>GuillermoPH</dc:creator>
      <dc:date>2018-03-12T20:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Filter last month</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filter-last-month/m-p/444939#M28772</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the INTNX function to do this, depending on how you want to use it, you could use the SAS Macro language to create the start end end values. Please note the macro variables currently just contain the correct string representation to actually make a proper date value out of it, you need to put them into quotes and add the DT so that in the end, you get "01FEB2018:00:00:00"dt&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let currentDT = %sysfunc( datetime() );
%let prevMonthStart = %sysfunc( intnx(DTMONTH, &amp;amp;currentDT, -1, B), datetime19.);
%let prevMonthEnd = %sysfunc( intnx(DTMONTH, &amp;amp;currentDT, 0, B), datetime19.);


%put &amp;amp;=prevMonthStart &amp;amp;=prevMonthEnd;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or your filter expression in a query looks like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;t1.dt BETWEEN intnx("DTMONTH", datetime(), -1, "B") AND intnx("DTMONTH", datetime(), 0, "B")&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Mar 2018 21:00:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filter-last-month/m-p/444939#M28772</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2018-03-12T21:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: Filter last month</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filter-last-month/m-p/444961#M28780</link>
      <description>Thanks a lot Bruno_SAS! It worked beautifully, I used the second option since I'm working on queries. Regards,</description>
      <pubDate>Mon, 12 Mar 2018 22:16:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Filter-last-month/m-p/444961#M28780</guid>
      <dc:creator>GuillermoPH</dc:creator>
      <dc:date>2018-03-12T22:16:30Z</dc:date>
    </item>
  </channel>
</rss>

