<?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 filter last month and previous month data from date column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318877#M69922</link>
    <description>R u pull out this one&lt;BR /&gt;a requirement of multiple file have different locations are export to excel ..each file to each sheet ... Mainly we want on proc report if possible.</description>
    <pubDate>Wed, 14 Dec 2016 12:12:22 GMT</pubDate>
    <dc:creator>Badshaah</dc:creator>
    <dc:date>2016-12-14T12:12:22Z</dc:date>
    <item>
      <title>How filter last month and previous month data from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318602#M69823</link>
      <description>We have single data table in which we only required last month data ,&lt;BR /&gt;So i can calculate last date by max date but ..need logic for second last month.</description>
      <pubDate>Tue, 13 Dec 2016 15:52:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318602#M69823</guid>
      <dc:creator>Badshaah</dc:creator>
      <dc:date>2016-12-13T15:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: How filter last month and previous month data from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318603#M69824</link>
      <description>&lt;P&gt;First question: are your dates actually SAS date or datetime valued variables, character or something else? The functions to manipulate dates require SAS date, time or datetime values and to know which you have.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 18:09:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318603#M69824</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-14T18:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: How filter last month and previous month data from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318605#M69825</link>
      <description>It's form base table having variable in date9 format</description>
      <pubDate>Tue, 13 Dec 2016 15:58:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318605#M69825</guid>
      <dc:creator>Badshaah</dc:creator>
      <dc:date>2016-12-13T15:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: How filter last month and previous month data from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318608#M69826</link>
      <description>Could you please provide sample data with expected output to help you better.</description>
      <pubDate>Tue, 13 Dec 2016 16:01:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318608#M69826</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2016-12-13T16:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: How filter last month and previous month data from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318610#M69827</link>
      <description>employee_&lt;BR /&gt;Obs id jobcat transmonth wage rating&lt;BR /&gt;&lt;BR /&gt;1 1254 one 29AUG1998 $11000.00 2&lt;BR /&gt;2 9936 two 17OCT1998 $5,000.00 0&lt;BR /&gt;3 7529 two 04NOV1998 $9,000.00 1&lt;BR /&gt;4 9154 one 25NOV1998 $10000.00 2&lt;BR /&gt;5 7741 two 18NOV1998 $9,500.00 3&lt;BR /&gt;6 8896 two 11OCT1998 $9,600.00 4&lt;BR /&gt;7 6658 one 01MAY1999 $12000.00 4&lt;BR /&gt;8 7854 two 27OCT1998 $9,600.00 3&lt;BR /&gt;9 9458 two 13NOV1998 $8,999.00 1&lt;BR /&gt;10 7887 two 19OCT1998 $9,050.00 0</description>
      <pubDate>Tue, 13 Dec 2016 16:14:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318610#M69827</guid>
      <dc:creator>Badshaah</dc:creator>
      <dc:date>2016-12-13T16:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: How filter last month and previous month data from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318611#M69828</link>
      <description>We have two calculate only last month which max of month and .. Second last month</description>
      <pubDate>Tue, 13 Dec 2016 16:16:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318611#M69828</guid>
      <dc:creator>Badshaah</dc:creator>
      <dc:date>2016-12-13T16:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: How filter last month and previous month data from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318634#M69831</link>
      <description>&lt;P&gt;So in the sample data you provided, 25NOV1998 is the maximum value for the incoming dates.&amp;nbsp; What would you like the beginning and ending points to be for your time period?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 16:45:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318634#M69831</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-12-13T16:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: How filter last month and previous month data from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318635#M69832</link>
      <description>It's just sample data .. If 28nov2016 is max then max -1 months 30oct2016 is also needed but we have to convert date9. To monyy7. Format which only extract month and year.</description>
      <pubDate>Tue, 13 Dec 2016 16:48:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318635#M69832</guid>
      <dc:creator>Badshaah</dc:creator>
      <dc:date>2016-12-13T16:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: How filter last month and previous month data from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318637#M69834</link>
      <description>&lt;P&gt;OK.&amp;nbsp; Assuming you have the max date already calculated:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cutoff_date = intnx('month', max_date, -1, 'e');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This gets you a SAS date value that you can express in any format that you choose.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 16:51:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318637#M69834</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-12-13T16:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: How filter last month and previous month data from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318664#M69844</link>
      <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; one ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;infile&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;retain&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; obs id jobcat transmonth wage rating;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; transmonth &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; wage &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;dollar10.2&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; obs id jobcat $ transmonth &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; wage &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;dollar10.2&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; rating;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;1 1254 one 29AUG1998 $11000.00 2&lt;/P&gt;&lt;P&gt;2 9936 two 17OCT1998 $5,000.00 0&lt;/P&gt;&lt;P&gt;3 7529 two 04NOV1998 $9,000.00 1&lt;/P&gt;&lt;P&gt;4 9154 one 25NOV1998 $10000.00 2&lt;/P&gt;&lt;P&gt;5 7741 two 18NOV1998 $9,500.00 3&lt;/P&gt;&lt;P&gt;6 8896 two 11OCT1998 $9,600.00 4&lt;/P&gt;&lt;P&gt;7 6658 one 01MAY1998 $12000.00 4&lt;/P&gt;&lt;P&gt;8 7854 two 27OCT1998 $9,600.00 3&lt;/P&gt;&lt;P&gt;9 9458 two 13NOV1998 $8,999.00 1&lt;/P&gt;&lt;P&gt;10 7887 two 19OCT1998 $9,050.00 0&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;/* -Finding the max date and storing in a macro*/&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;noprint&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; max(transmonth) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;INTO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; : maxdate&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; one;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;maxdate;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;/* -Getting all the records with months as max date and month prior */&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; two;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;retain&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; obs id jobcat transmonth wage rating;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;FORMAT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; transmonth &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;MONYY7.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; one;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; month(transmonth)= month(&amp;amp;maxdate) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;OR&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; month(transmonth)= month(&amp;amp;maxdate)-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 18:25:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318664#M69844</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2016-12-13T18:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: How filter last month and previous month data from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318787#M69892</link>
      <description>Thanks suryakiran &amp;amp; Astounding.</description>
      <pubDate>Wed, 14 Dec 2016 09:39:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318787#M69892</guid>
      <dc:creator>Badshaah</dc:creator>
      <dc:date>2016-12-14T09:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: How filter last month and previous month data from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318861#M69916</link>
      <description>&lt;P&gt;Just be careful to adjust the solution for January. &amp;nbsp;As is, the program will look for month=0 instead of month=12.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 11:50:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318861#M69916</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-12-14T11:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: How filter last month and previous month data from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318866#M69919</link>
      <description>Then what's the solution for that</description>
      <pubDate>Wed, 14 Dec 2016 12:03:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318866#M69919</guid>
      <dc:creator>Badshaah</dc:creator>
      <dc:date>2016-12-14T12:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: How filter last month and previous month data from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318873#M69920</link>
      <description>&lt;P&gt;Based on the tools that I had posted originally:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if (&amp;nbsp;&lt;SPAN&gt;intnx('month', max_date, -1, 'b') &amp;lt;= transmonth &amp;lt;= intnx('month', max_date, -1, 'e') );&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In fact, the solution as posted only looks at month. &amp;nbsp;If you have a data set that includes more than one year of data, you can be selecting based on month only, including data from a previous year.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 12:10:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318873#M69920</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-12-14T12:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: How filter last month and previous month data from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318875#M69921</link>
      <description>Grand salute ..to u .. Thanks</description>
      <pubDate>Wed, 14 Dec 2016 12:11:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318875#M69921</guid>
      <dc:creator>Badshaah</dc:creator>
      <dc:date>2016-12-14T12:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: How filter last month and previous month data from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318877#M69922</link>
      <description>R u pull out this one&lt;BR /&gt;a requirement of multiple file have different locations are export to excel ..each file to each sheet ... Mainly we want on proc report if possible.</description>
      <pubDate>Wed, 14 Dec 2016 12:12:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-filter-last-month-and-previous-month-data-from-date-column/m-p/318877#M69922</guid>
      <dc:creator>Badshaah</dc:creator>
      <dc:date>2016-12-14T12:12:22Z</dc:date>
    </item>
  </channel>
</rss>

