<?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: data _null_ captuing incorrect date variable output in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/data-null-captuing-incorrect-date-variable-output/m-p/175384#M45014</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the only thing you are going to use &amp;amp;m for is to create those values then don't bother. You have a string which the date functions won't recognize correctly. Hint: do the arithmetic 2014 minus 09 minus 30 and display the result using a date format..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the &amp;amp;pbd_date instead in your current and previous month calculations.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Oct 2014 20:04:39 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2014-10-07T20:04:39Z</dc:date>
    <item>
      <title>data _null_ captuing incorrect date variable output</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data-null-captuing-incorrect-date-variable-output/m-p/175383#M45013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;This code represents a call symput macro that formats the last day of the previous month.&amp;nbsp; I include the output symbolgen&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; symput(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'m'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,put(&amp;amp;pbd_date,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal;"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;));&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; &amp;amp;m;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;SYMBOLGEN:&amp;nbsp; Macro variable M resolves to 2014-09-30&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;10648&amp;nbsp; %put &amp;amp;m;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;2014-09-30&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt; Now I want to use &amp;amp;m to define the previous month and the last 2 months consecutively.&amp;nbsp; The data _null_ accomplished that with no issue&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt; However if you look at the information in red, when I use the put statements I get March and April 1965 not 2014.&amp;nbsp; I am scratching my head here.&amp;nbsp; For those who have worked with date variables any suggestions&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;_NULL_&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; symput ( &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'curr_month1'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;, cat(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;"'"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;||put(intnx(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'month'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal;"&gt;m.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,-&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'e'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal;"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;)||&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;"'"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; symput ( &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'prev_month1'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;, cat(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;"'"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;||put(intnx(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'month'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal;"&gt;m.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,-&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'e'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal;"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;)||&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;"'"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; &amp;amp;curr_month1 &amp;amp;prev_month1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;10611&amp;nbsp; call symput ( 'curr_month1', cat("'"||put(intnx('month',&amp;amp;m.,-1,'e'),yymmdd10.)||"'"));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;SYMBOLGEN:&amp;nbsp; Macro variable M resolves to 2014-09-30&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;10612&amp;nbsp; call symput ( 'prev_month1', cat("'"||put(intnx('month',&amp;amp;m.,-2,'e'),yymmdd10.)||"'"));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;SYMBOLGEN:&amp;nbsp; Macro variable M resolves to 2014-09-30&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;10613&amp;nbsp; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green;"&gt;NOTE: DATA statement used (Total process time):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: red; background: white; font-family: 'Courier New';"&gt;SYMBOLGEN:&amp;nbsp; Macro variable CURR_MONTH1 resolves to '1965-04-30'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: red; background: white; font-family: 'Courier New';"&gt;SYMBOLGEN:&amp;nbsp; Macro variable PREV_MONTH1 resolves to '1965-03-31'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: red; background: white; font-family: 'Courier New';"&gt;10614&amp;nbsp; %put &amp;amp;curr_month1 &amp;amp;prev_month1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: red; background: white; font-family: 'Courier New';"&gt;'1965-04-30' '1965-03-31'&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Oct 2014 19:16:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data-null-captuing-incorrect-date-variable-output/m-p/175383#M45013</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2014-10-07T19:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: data _null_ captuing incorrect date variable output</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data-null-captuing-incorrect-date-variable-output/m-p/175384#M45014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the only thing you are going to use &amp;amp;m for is to create those values then don't bother. You have a string which the date functions won't recognize correctly. Hint: do the arithmetic 2014 minus 09 minus 30 and display the result using a date format..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the &amp;amp;pbd_date instead in your current and previous month calculations.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Oct 2014 20:04:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data-null-captuing-incorrect-date-variable-output/m-p/175384#M45014</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-10-07T20:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: data _null_ captuing incorrect date variable output</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data-null-captuing-incorrect-date-variable-output/m-p/175385#M45015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried the code below, but the macro put statement doesn't produce the desired result 2014/10/08 in the macro variable m. Do I need to change any formats?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;15&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; options symbolgen;&lt;BR /&gt;16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let pbd_date= 2014/10/08;&lt;BR /&gt;18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data _null_;&lt;BR /&gt;19&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput('m',put(&amp;amp;pbd_date,yymmdd10.));&lt;BR /&gt;SYMBOLGEN:&amp;nbsp; Macro variable PBD_DATE resolves to 2014/10/08&lt;BR /&gt;21&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;22&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;23&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;24&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put &amp;amp;m;&lt;BR /&gt;SYMBOLGEN:&amp;nbsp; Macro variable M resolves to 1960-01-26&lt;BR /&gt;1960-01-26&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 12pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 12pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2014 07:19:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data-null-captuing-incorrect-date-variable-output/m-p/175385#M45015</guid>
      <dc:creator>RamKumar</dc:creator>
      <dc:date>2014-10-08T07:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: data _null_ captuing incorrect date variable output</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data-null-captuing-incorrect-date-variable-output/m-p/175386#M45016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason for getting the incorrect values is the using of text value provided by the macro variable &lt;EM&gt;&amp;amp;m &lt;/EM&gt;as the second argument of the function intnx. As per SAS documentation of &lt;STRONG&gt;intnx&lt;/STRONG&gt; function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="strong"&gt;&lt;A name="a000843842"&gt;&lt;/A&gt;&lt;STRONG&gt;&lt;SPAN class="strongEmph"&gt;start-from&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A name="a000843843"&gt;&lt;/A&gt;&lt;EM&gt;specifies a SAS expression that represents a SAS date, time, or datetime value that identifies a starting point&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One solution:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _NULL_;&lt;/P&gt;&lt;P&gt;call symput ( 'curr_month1', &lt;BR /&gt;cat("'"||put(intnx('month',input("&amp;amp;m",yymmdd10.),-1,'e'),yymmdd10.)||"'"));&lt;BR /&gt;call symput ( 'prev_month1', &lt;BR /&gt;cat("'"||put(intnx('month',input("&amp;amp;m",yymmdd10.),-2,'e'),yymmdd10.)||"'"));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2014 07:47:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data-null-captuing-incorrect-date-variable-output/m-p/175386#M45016</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2014-10-08T07:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: data _null_ captuing incorrect date variable output</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data-null-captuing-incorrect-date-variable-output/m-p/175387#M45017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe that you haven't fully understood yet how SAS dates work and that this is the reason for your struggle. The following link should help you to overcome this hurdle &lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/67401/HTML/default/viewer.htm#p1wj0wt2ebe2a0n1lv4lem9hdc0v.htm" title="http://support.sas.com/documentation/cdl/en/lrcon/67401/HTML/default/viewer.htm#p1wj0wt2ebe2a0n1lv4lem9hdc0v.htm"&gt;SAS(R) 9.4 Language Reference: Concepts, Third Edition&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here some code which should do what you're after. I personally wouldn't add the quotes to the date string. You can do this later when using the macro variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let pbd_date=%sysfunc(inputn(2014/10/08,yymmdd10.));&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput('m',put(&amp;amp;pbd_date,yymmdd10.));&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput('curr_month1', cats("'",put(intnx('month',&amp;amp;pbd_date.,-1,'e'),yymmdd10.),"'"));&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput('prev_month1', cats("'",put(intnx('month',&amp;amp;pbd_date.,-2,'e'),yymmdd10.),"'"));&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symputx('curr_month2', put(intnx('month',&amp;amp;pbd_date.,-1,'e'),yymmdd10.));&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symputx('prev_month2', put(intnx('month',&amp;amp;pbd_date.,-2,'e'),yymmdd10.));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%put &amp;amp;pbd_date &amp;amp;m;&lt;/P&gt;&lt;P&gt;%put &amp;amp;curr_month1 &amp;amp;prev_month1;&lt;/P&gt;&lt;P&gt;%put &amp;amp;curr_month2 &amp;amp;prev_month2;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2014 11:10:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data-null-captuing-incorrect-date-variable-output/m-p/175387#M45017</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-10-08T11:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: data _null_ captuing incorrect date variable output</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data-null-captuing-incorrect-date-variable-output/m-p/175388#M45018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the value of &amp;amp;pgd_date In this code you posted earlier:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background: white; color: navy; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;call&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; symput(&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New';"&gt;'m'&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;,put(&amp;amp;pbd_date,&lt;/SPAN&gt;&lt;SPAN style="background: white; color: teal; font-family: 'Courier New';"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;));&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background: white; color: navy; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;since M resolved to &lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;2014-09-30 then &amp;amp;pdd_date was the proper date value.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; background: white; font-family: 'Courier New';"&gt;But when you do:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; background: white; font-family: 'Courier New';"&gt;%let pbd_date= 2014/10/08;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; background: white; font-family: 'Courier New';"&gt;You are assigning it a completely different value. Why? Where did the original &amp;amp;pbd_date come from? USE IT.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2014 14:45:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data-null-captuing-incorrect-date-variable-output/m-p/175388#M45018</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-10-08T14:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: data _null_ captuing incorrect date variable output</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/data-null-captuing-incorrect-date-variable-output/m-p/175389#M45019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="background: white; color: navy; font-family: 'Courier New';"&gt;In your current approach, you are converting a date(&amp;amp;pbd_date) to a string (&amp;amp;M).&amp;nbsp; You are then trying to convert this date back to a string before performing calculations.&amp;nbsp; You can greatly simplify the process if you use the original date .&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background: white; color: navy; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;call&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; symput(&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New';"&gt;'m'&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;,put(&amp;amp;pbd_date,&lt;/SPAN&gt;&lt;SPAN style="background: white; color: teal; font-family: 'Courier New';"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;));&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt; call&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; symput(&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New';"&gt;'curr_month1'&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;, put(intnx('month',(&amp;amp;pbd_date,-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1,'e'),yymmdd10.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt; call&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; symput(&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New';"&gt;'prev_month1'&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;, put(intnx('month',(&amp;amp;pbd_date,-2,'e'),yymmdd10.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background: white; color: navy; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;The reason this works is because &amp;amp;m is not an actual date, but rather a string.&amp;nbsp; If you want to stay with your previous approach, you can do that using an informat:&amp;nbsp; input(&amp;amp;m,yymmdd10.).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Oct 2014 17:56:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/data-null-captuing-incorrect-date-variable-output/m-p/175389#M45019</guid>
      <dc:creator>nathan_owens</dc:creator>
      <dc:date>2014-10-09T17:56:13Z</dc:date>
    </item>
  </channel>
</rss>

