<?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: auto dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/auto-dates/m-p/353496#M82521</link>
    <description>&lt;P&gt;Or&lt;/P&gt;
&lt;PRE&gt;&lt;FONT face="SAS Monospace" size="2"&gt;data _null_;
   call symputx('YYYMM',put(intnx('month',today(),-1),yymmn6.));
   call symputx('date1',intnx('month',today(),-1,'b'));
   call symputx('date2',intnx('month',today(),0,'b'));
run;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which is much easier on my eyes than nested %sysfunc.&lt;/P&gt;
&lt;P&gt;Yes, this does not have '01Apr2017'd but the numeric value that the date resolves to. Unless you are actually putting date1 and date2 into text output such as a title then the numeric will work just fine.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Apr 2017 23:05:46 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-04-25T23:05:46Z</dc:date>
    <item>
      <title>auto dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/auto-dates/m-p/353482#M82516</link>
      <description>&lt;P&gt;in our sas program we have dates thta are hard coded, something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let YYYYMM = 201704;&lt;BR /&gt;%let date1 = '01Apr2017'd;&lt;BR /&gt;%let date2 = '01May2017'd;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;everythime we run a report, have to manually change them. can yo uplease advise how to automate these values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;YYYMM is the previous month and year&lt;/P&gt;
&lt;P&gt;date1 is the first date of the previous month&lt;/P&gt;
&lt;P&gt;date2 is the first daty of the current month&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks in advance&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, 25 Apr 2017 22:28:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/auto-dates/m-p/353482#M82516</guid>
      <dc:creator>tparvaiz</dc:creator>
      <dc:date>2017-04-25T22:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: auto dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/auto-dates/m-p/353492#M82518</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let YYYYMM =         %sysfunc(putn(%sysfunc(intnx(month,%sysfunc(today()),-1)),yymmn6.));
%let date1  = %str(%')%sysfunc(putn(%sysfunc(intnx(month,%sysfunc(today()),-1)),date9.))%str(%')d;
%let date2  = %str(%')%sysfunc(putn(%sysfunc(intnx(month,%sysfunc(today()), 0)),date9.))%str(%')d;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Apr 2017 22:49:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/auto-dates/m-p/353492#M82518</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-04-25T22:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: auto dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/auto-dates/m-p/353496#M82521</link>
      <description>&lt;P&gt;Or&lt;/P&gt;
&lt;PRE&gt;&lt;FONT face="SAS Monospace" size="2"&gt;data _null_;
   call symputx('YYYMM',put(intnx('month',today(),-1),yymmn6.));
   call symputx('date1',intnx('month',today(),-1,'b'));
   call symputx('date2',intnx('month',today(),0,'b'));
run;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which is much easier on my eyes than nested %sysfunc.&lt;/P&gt;
&lt;P&gt;Yes, this does not have '01Apr2017'd but the numeric value that the date resolves to. Unless you are actually putting date1 and date2 into text output such as a title then the numeric will work just fine.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 23:05:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/auto-dates/m-p/353496#M82521</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-04-25T23:05:46Z</dc:date>
    </item>
  </channel>
</rss>

