<?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 Macro dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470023#M120291</link>
    <description>&lt;P&gt;I am trying to create two macro dates using enterprise&amp;nbsp;guide 7.1 SAS version 9.4. The first date is based off of today's date and works fine. alpha is yesterday.&amp;nbsp; The second date is suppose to be the same day in the prior month from alpha.&amp;nbsp; So if today is June 13, alpha is jun 12 and beta would be may 12.&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 color="#0000ff" face="Courier New" size="3"&gt;_null_&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;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; symputx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'alpha'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, PUT(intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'DAY'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%SYSFUNC&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(today()),-&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;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;)); &lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;* yesterday;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;call symputx('beta', PUT(intnx('MONTH',%SYSFUNC(&amp;amp;alpha,-1), date9.));&lt;/FONT&gt; &lt;FONT color="#008000" face="Courier New" size="3"&gt;* last month same day;&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>Wed, 13 Jun 2018 17:51:44 GMT</pubDate>
    <dc:creator>pangea17</dc:creator>
    <dc:date>2018-06-13T17:51:44Z</dc:date>
    <item>
      <title>Macro dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470023#M120291</link>
      <description>&lt;P&gt;I am trying to create two macro dates using enterprise&amp;nbsp;guide 7.1 SAS version 9.4. The first date is based off of today's date and works fine. alpha is yesterday.&amp;nbsp; The second date is suppose to be the same day in the prior month from alpha.&amp;nbsp; So if today is June 13, alpha is jun 12 and beta would be may 12.&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 color="#0000ff" face="Courier New" size="3"&gt;_null_&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;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; symputx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'alpha'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, PUT(intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'DAY'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%SYSFUNC&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(today()),-&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;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;)); &lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;* yesterday;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;call symputx('beta', PUT(intnx('MONTH',%SYSFUNC(&amp;amp;alpha,-1), date9.));&lt;/FONT&gt; &lt;FONT color="#008000" face="Courier New" size="3"&gt;* last month same day;&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>Wed, 13 Jun 2018 17:51:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470023#M120291</guid>
      <dc:creator>pangea17</dc:creator>
      <dc:date>2018-06-13T17:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Macro dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470031#M120296</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;

call symputx('alpha', PUT(intnx('DAY',today(),-1), date9.)); * yesterday;

call symputx('beta', PUT(intnx('MONTH',today(),-1,'s'), date9.)); * last month same day;

RUN;

%put &amp;amp;alpha;

%put &amp;amp;beta;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Jun 2018 18:08:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470031#M120296</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-06-13T18:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: Macro dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470032#M120297</link>
      <description>&lt;P&gt;Corrected&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;

call symputx('alpha', PUT(intnx('DAY',today(),-1), date9.)); * yesterday;

call symputx('beta', PUT(intnx('MONTH',today()-1,-1,'s'), date9.)); * last month same day;

RUN;

%put &amp;amp;alpha;

%put &amp;amp;beta;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Jun 2018 18:09:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470032#M120297</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-06-13T18:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Macro dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470041#M120299</link>
      <description>&lt;P&gt;NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR&lt;/P&gt;
&lt;P&gt;24&lt;/P&gt;
&lt;P&gt;25 GOPTIONS ACCESSIBLE;&lt;/P&gt;
&lt;P&gt;26 data _null_;&lt;/P&gt;
&lt;P&gt;27 call symputx('alpha', PUT(intnx('DAY',today(),-1), date9.)); * yesterday;&lt;/P&gt;
&lt;P&gt;28 call symputx('beta', PUT(intnx('MONTH',today(),-1,-1,'s'), date9.)); * yesterday;&lt;/P&gt;
&lt;P&gt;29 RUN;&lt;/P&gt;
&lt;P&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).&lt;/P&gt;
&lt;P&gt;28:51&lt;/P&gt;
&lt;P&gt;NOTE: Argument 5 to function INTNX('MONTH',21348,-1,' -1','s') at line 28 column 26 is invalid.&lt;/P&gt;
&lt;P&gt;_ERROR_=1 _N_=1&lt;/P&gt;
&lt;P&gt;NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to&lt;/P&gt;
&lt;P&gt;missing values.&lt;/P&gt;
&lt;P&gt;Each place is given by: (Number of times) at (Line):(Column).&lt;/P&gt;
&lt;P&gt;1 at 28:26&lt;/P&gt;
&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;
&lt;P&gt;real time 0.01 seconds&lt;/P&gt;
&lt;P&gt;cpu time 0.00 seconds&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 18:34:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470041#M120299</guid>
      <dc:creator>pangea17</dc:creator>
      <dc:date>2018-06-13T18:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470045#M120300</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15692"&gt;@pangea17&lt;/a&gt;&amp;nbsp;you didn't quite exactly copy paste my code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;there is a difference in the 2nd call symputx with yours and mine. Kindly review thoroughly. Please and thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;mine&lt;/STRONG&gt;:&amp;nbsp; call symputx('beta', PUT(intnx('MONTH',&lt;STRONG&gt;today()-1,-1,'s'),&lt;/STRONG&gt; date9.)); * last month same day;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;yours&lt;/STRONG&gt;:&amp;nbsp; call symputx('beta', PUT(intnx('MONTH',&lt;STRONG&gt;today(),-1,-1,'s')&lt;/STRONG&gt;, date9.)); * yesterday;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 18:41:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470045#M120300</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-06-13T18:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Macro dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470050#M120301</link>
      <description>&lt;P&gt;That did work great!&amp;nbsp; Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 18:42:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470050#M120301</guid>
      <dc:creator>pangea17</dc:creator>
      <dc:date>2018-06-13T18:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Macro dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470051#M120302</link>
      <description>&lt;P&gt;I'm glad. Have fun!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 18:42:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470051#M120302</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-06-13T18:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: Macro dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470052#M120303</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15692"&gt;@pangea17&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to create two macro dates using enterprise&amp;nbsp;guide 7.1 SAS version 9.4. The first date is based off of today's date and works fine. alpha is yesterday.&amp;nbsp; The second date is suppose to be the same day in the prior month from alpha.&amp;nbsp; So if today is June 13, alpha is jun 12 and beta would be may 12.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; symputx(&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'alpha'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, PUT(intnx(&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'DAY'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%SYSFUNC&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(today()),-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;), &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;)); &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008000"&gt;* yesterday;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#008000"&gt;call symputx('beta', PUT(intnx('MONTH',%SYSFUNC(&amp;amp;alpha,-1), date9.));&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#008000"&gt;* last month same day;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&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;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In your code, the macro preprocessor tries to resolve &amp;amp;alpha before it is created.&lt;/P&gt;
&lt;P&gt;%sysfunc only accepts a data step function call as its argument, and not a macro variable.&lt;/P&gt;
&lt;P&gt;A previous day is calculated best by simply subtracting 1 from a date.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
call symputx('alpha', put(today()-1, date9.)); * yesterday;
call symputx('beta', put(intnx('month',today()-1,-1), date9.)); * last month same day;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Jun 2018 18:47:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-dates/m-p/470052#M120303</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-13T18:47:20Z</dc:date>
    </item>
  </channel>
</rss>

