<?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: previous month in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/previous-month/m-p/46969#M9695</link>
    <description>and the equivalent code to operate on macro variables, is:&lt;BR /&gt;
 %let last_month = %sysfunc( intnx( month, "&amp;amp;sysdate9"d, -1 ), yymmd7 );&lt;BR /&gt;
%put &amp;amp;last_month ;&lt;BR /&gt;
&lt;BR /&gt;
(works for me)</description>
    <pubDate>Sat, 20 Jun 2009 17:11:18 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2009-06-20T17:11:18Z</dc:date>
    <item>
      <title>previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/previous-month/m-p/46966#M9692</link>
      <description>data dat;&lt;BR /&gt;
	  &lt;BR /&gt;
file_date=substr(put("&amp;amp;sysdate"d,mmddyy10.),7,4)||'-'||substr(put("&amp;amp;sysdate"d,mmddyy10.),1,2);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
File_date resolves to 2009-06.&lt;BR /&gt;
&lt;BR /&gt;
How to get 2009-05 instead?</description>
      <pubDate>Fri, 19 Jun 2009 16:27:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/previous-month/m-p/46966#M9692</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2009-06-19T16:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/previous-month/m-p/46967#M9693</link>
      <description>I suggest working with the SAS DATE numeric-type variables for a more straightforward technique, and also so you can use INTNX, for deriving date values and date-strings.&lt;BR /&gt;
&lt;BR /&gt;
In a DATA step, use the PUT function with a SAS DATE type variable, if you need to assign a character-type variable, for some purpose:&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
mytoday = "&amp;amp;sysdate9"d;&lt;BR /&gt;
format mytoday date9. ;&lt;BR /&gt;
today_yymmdd = put( mytoday,yymmdd6.);&lt;BR /&gt;
putlog _all_;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
The SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website provides SAS-hosted documentation and supplemental technica/conference papers on this topic - use the website SEARCH or a Google advanced search, adding the site:sas.com  parmeter to limit your search to the SAS.COM site.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
SAS DOC - Working with Dates in the SAS System:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001304321.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001304321.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Using SAS® Dates and Times – A Tutorial&lt;BR /&gt;
Jonas V. Bilenas, JP Morgan Chase, Wilmington, DE&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/forum2007/226-2007.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2007/226-2007.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
TS-668&lt;BR /&gt;
SAS Dates, Times, and Interval Functions&lt;BR /&gt;
Definitions and Explanations&lt;BR /&gt;
SAS Dates, Times, and Datetimes:&lt;BR /&gt;
&lt;A href="http://support.sas.com/techsup/technote/ts668.pdf" target="_blank"&gt;http://support.sas.com/techsup/technote/ts668.pdf&lt;/A&gt;</description>
      <pubDate>Fri, 19 Jun 2009 16:34:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/previous-month/m-p/46967#M9693</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-06-19T16:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/previous-month/m-p/46968#M9694</link>
      <description>Hello SASPhile,&lt;BR /&gt;
&lt;BR /&gt;
This could be the solution to your problem:&lt;BR /&gt;
&lt;BR /&gt;
data dat;&lt;BR /&gt;
length file_date $7;&lt;BR /&gt;
file_date=put(intnx('month',date(),-1),YYMMD7.);&lt;BR /&gt;
put file_Date=;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Could you tell whether this solves the problem?&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
&lt;BR /&gt;
Yoba</description>
      <pubDate>Fri, 19 Jun 2009 16:51:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/previous-month/m-p/46968#M9694</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-06-19T16:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/previous-month/m-p/46969#M9695</link>
      <description>and the equivalent code to operate on macro variables, is:&lt;BR /&gt;
 %let last_month = %sysfunc( intnx( month, "&amp;amp;sysdate9"d, -1 ), yymmd7 );&lt;BR /&gt;
%put &amp;amp;last_month ;&lt;BR /&gt;
&lt;BR /&gt;
(works for me)</description>
      <pubDate>Sat, 20 Jun 2009 17:11:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/previous-month/m-p/46969#M9695</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-06-20T17:11:18Z</dc:date>
    </item>
  </channel>
</rss>

