<?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: subtract date macro with numeric macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/subtract-date-macro-with-numeric-macro/m-p/625047#M184199</link>
    <description>&lt;P&gt;Despite the code you showed, it seems as if &amp;amp;DAYS has not been defined. So I conclude you didn't run the code you showed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, place this command at the start of your code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint symbolgen mlogic;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and run it again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then copy the log (the &lt;STRONG&gt;entire&lt;/STRONG&gt; log, not just the error messages) as text and paste it into the window that appears when you click on the {i} icon. DO NOT SKIP THIS STEP. This helps keep the formatting of the log readable. Please help us out, and help us help you, by following these instructions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 16 Feb 2020 00:45:18 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-02-16T00:45:18Z</dc:date>
    <item>
      <title>subtract date macro with numeric macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/subtract-date-macro-with-numeric-macro/m-p/624973#M184171</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a program that has user input fields to create certain parameters throughout the code, in this case, a lookback period for a date/date range, and formatting is applied several times so that it works in various queries. I am getting an error at the calculation, however. Please help!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;U&gt;&lt;STRONG&gt;This is the error:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;215 /**********************************************************************************************************************************************/&lt;/P&gt;&lt;P&gt;216 **macro to calculate lookback for staging based on incident start date;&lt;/P&gt;&lt;P&gt;217&lt;/P&gt;&lt;P&gt;218 data temp;&lt;/P&gt;&lt;P&gt;219 DTL = &amp;amp;date1. - &amp;amp;Days.;&lt;/P&gt;&lt;P&gt;_&lt;/P&gt;&lt;P&gt;22&lt;/P&gt;&lt;P&gt;200&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference DAYS not resolved.&lt;/P&gt;&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, a missing value, arrayname, (, +, -, INPUT, NOT, PUT, ^, _NEW_, ~.&lt;/P&gt;&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;220 format DTL yymmdd10.;&lt;/P&gt;&lt;P&gt;221 run;&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;&lt;U&gt;&lt;STRONG&gt;I've included below the relevant pieces of code.&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;"&lt;BR /&gt;/*SAS FORMATTED INCIDENT START DATE*/&lt;/P&gt;&lt;P&gt;%let date1 = '06Dec2019'd;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/**lookback x days**/&lt;/P&gt;&lt;P&gt;%let Days = 35; /*no lookback for staging, input "0"*/&lt;/P&gt;&lt;P&gt;/**********************************************************************************************************************************************/&lt;/P&gt;&lt;P&gt;**macro to calculate lookback for staging based on incident start date;&lt;/P&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt;DTL = &amp;amp;date1. - &amp;amp;Days.;&lt;/P&gt;&lt;P&gt;format DTL yymmdd10.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;select DTL into :DTLa&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Feb 2020 00:42:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/subtract-date-macro-with-numeric-macro/m-p/624973#M184171</guid>
      <dc:creator>Klakola</dc:creator>
      <dc:date>2020-02-15T00:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: subtract date macro with numeric macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/subtract-date-macro-with-numeric-macro/m-p/625012#M184187</link>
      <description>&lt;P&gt;When I copied your code (excluding the final proc sql), it worked fine on SAS 9.4 on my PC.&amp;nbsp; I ended up with a data set called TEMP containing one observation with one variable called DTL having a numeric date value corresponding to Nov 1, 2019.&amp;nbsp; I did not receive the warning, because the macro variable Days resolved as expected.&amp;nbsp; I'm not sure why this isn't working for you.&amp;nbsp; Have you tried restarting your SAS session and just running this little bit of code?&lt;/P&gt;</description>
      <pubDate>Sat, 15 Feb 2020 14:37:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/subtract-date-macro-with-numeric-macro/m-p/625012#M184187</guid>
      <dc:creator>jmhorstman</dc:creator>
      <dc:date>2020-02-15T14:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: subtract date macro with numeric macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/subtract-date-macro-with-numeric-macro/m-p/625015#M184189</link>
      <description>&lt;P&gt;Are you just talking about the two macro variables that your code is defining and then using?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Show the line from the log with the error (before line number 215) where the macro variable DAYS was assigned a value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you actually have a macro?&amp;nbsp; Is it possible you defined a local macro variable named DAYS in a macro that has now finished? Once a macro stops running its local macro scope disappears.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Feb 2020 15:09:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/subtract-date-macro-with-numeric-macro/m-p/625015#M184189</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-15T15:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: subtract date macro with numeric macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/subtract-date-macro-with-numeric-macro/m-p/625047#M184199</link>
      <description>&lt;P&gt;Despite the code you showed, it seems as if &amp;amp;DAYS has not been defined. So I conclude you didn't run the code you showed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, place this command at the start of your code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint symbolgen mlogic;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and run it again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then copy the log (the &lt;STRONG&gt;entire&lt;/STRONG&gt; log, not just the error messages) as text and paste it into the window that appears when you click on the {i} icon. DO NOT SKIP THIS STEP. This helps keep the formatting of the log readable. Please help us out, and help us help you, by following these instructions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Feb 2020 00:45:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/subtract-date-macro-with-numeric-macro/m-p/625047#M184199</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-16T00:45:18Z</dc:date>
    </item>
  </channel>
</rss>

