<?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: &amp;quot;Date&amp;quot; macro variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/quot-Date-quot-macro-variables/m-p/256169#M57116</link>
    <description>&lt;P&gt;Read the log - it's quite helpful &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The generated code turns out to be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date1=1603;
date2=11Mar2016;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For date1, it's a number so there's no issue.&lt;/P&gt;
&lt;P&gt;For date1 however, it appears to be a character so it needs quotes. If you want to keep it as a date then include the d, to specifiy a date literal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date2="&amp;amp;dte2."d;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The log indicates that it's trying to pass a character variable and points you to the error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1087  data test;
1088  date1=&amp;amp;dte1;
SYMBOLGEN:  Macro variable DTE1 resolves to 1603
1089  date2=&amp;amp;dte2;
SYMBOLGEN:  Macro variable DTE2 resolves to 11MAR2016
NOTE: Line generated by the macro variable "DTE2".
1     11MAR2016
        -------
        22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=,
              &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR,
              ^=, |, ||, ~=.

1090
1091  run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 11 Mar 2016 17:14:56 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-03-11T17:14:56Z</dc:date>
    <item>
      <title>"Date" macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/quot-Date-quot-macro-variables/m-p/256167#M57115</link>
      <description>&lt;P&gt;hi guys,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; symput (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'dte1'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;, put(today(),&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;yymmn4.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;));&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; symput (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'dte2'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;, put(today(),&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;));&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; test;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;date1=&amp;amp;dte1;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; date2=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&amp;amp;dte2&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;the code above wont work/run for date2=&amp;amp;dte2 but it&amp;nbsp; works if&amp;nbsp; date2="&amp;amp;dte2" &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;Can someone please explaing why?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;Thx&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 17:06:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/quot-Date-quot-macro-variables/m-p/256167#M57115</guid>
      <dc:creator>Tal</dc:creator>
      <dc:date>2016-03-11T17:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: "Date" macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/quot-Date-quot-macro-variables/m-p/256169#M57116</link>
      <description>&lt;P&gt;Read the log - it's quite helpful &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The generated code turns out to be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date1=1603;
date2=11Mar2016;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For date1, it's a number so there's no issue.&lt;/P&gt;
&lt;P&gt;For date1 however, it appears to be a character so it needs quotes. If you want to keep it as a date then include the d, to specifiy a date literal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date2="&amp;amp;dte2."d;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The log indicates that it's trying to pass a character variable and points you to the error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1087  data test;
1088  date1=&amp;amp;dte1;
SYMBOLGEN:  Macro variable DTE1 resolves to 1603
1089  date2=&amp;amp;dte2;
SYMBOLGEN:  Macro variable DTE2 resolves to 11MAR2016
NOTE: Line generated by the macro variable "DTE2".
1     11MAR2016
        -------
        22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=,
              &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR,
              ^=, |, ||, ~=.

1090
1091  run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Mar 2016 17:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/quot-Date-quot-macro-variables/m-p/256169#M57116</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-11T17:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: "Date" macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/quot-Date-quot-macro-variables/m-p/256170#M57117</link>
      <description>&lt;P&gt;What would you expect SAS to do if you typed this in a DATA step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dte2=11Mar2016;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course it would generate an error. &amp;nbsp;That's the program you generated, so that's the result that you got.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 17:22:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/quot-Date-quot-macro-variables/m-p/256170#M57117</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-03-11T17:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: "Date" macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/quot-Date-quot-macro-variables/m-p/256177#M57118</link>
      <description>&lt;P&gt;ohhh right&lt;/P&gt;
&lt;P&gt;cuz of the date9. format&amp;nbsp; a character variable is passed to dte2. did not realize&amp;nbsp; that &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you Reeza&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 17:43:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/quot-Date-quot-macro-variables/m-p/256177#M57118</guid>
      <dc:creator>Tal</dc:creator>
      <dc:date>2016-03-11T17:43:06Z</dc:date>
    </item>
  </channel>
</rss>

