<?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: macro fail - correction needed in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/macro-fail-correction-needed/m-p/617731#M19122</link>
    <description>thanks a lot</description>
    <pubDate>Thu, 16 Jan 2020 12:11:13 GMT</pubDate>
    <dc:creator>PierreYvesILY</dc:creator>
    <dc:date>2020-01-16T12:11:13Z</dc:date>
    <item>
      <title>macro fail - correction needed</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macro-fail-correction-needed/m-p/617719#M19119</link>
      <description>&lt;P&gt;dear&amp;nbsp;SAS experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to write a simple macro to calculate:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;the current date&lt;/LI&gt;&lt;LI&gt;the day before the current date&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;and use them afterwards in the programm.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* macro-code fuer den Auswertungstag */&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &lt;STRONG&gt;&lt;I&gt;auswert&lt;/I&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%global&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Date_of_today;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Date_of_today=&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;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; auswert;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;auswert&lt;/I&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;Date_of_today.;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &lt;STRONG&gt;&lt;I&gt;Auswertungstag&lt;/I&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Auswertungstag=&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;Date_of_today.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;-&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;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Auswertungstag; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;Auswertungstag&lt;/I&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* Der Monatszeitraum fängt an, mit dem Vormonat von dem Auswertungstag */&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;Auswertungstag.;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I have this error message in the log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* macro-code fuer den Auswertungstag */&lt;/P&gt;&lt;P&gt;27 %macro auswert;&lt;/P&gt;&lt;P&gt;28 %global Date_of_today;&lt;/P&gt;&lt;P&gt;29 %let Date_of_today=%sysfunc(today());&lt;/P&gt;&lt;P&gt;30 %mend auswert;&lt;/P&gt;&lt;P&gt;31 %auswert;&lt;/P&gt;&lt;P&gt;32 %put &amp;amp;Date_of_today.;&lt;/P&gt;&lt;P&gt;21930&lt;/P&gt;&lt;P&gt;33&lt;/P&gt;&lt;P&gt;34 %macro Auswertungstag;&lt;/P&gt;&lt;P&gt;35 Auswertungstag=&amp;amp;Date_of_today.-1;&lt;/P&gt;&lt;P&gt;36 %mend Auswertungstag;&lt;/P&gt;&lt;P&gt;37 %Auswertungstag;&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the invoked macro "AUSWERTUNGSTAG".&lt;/P&gt;&lt;P&gt;37 Auswertungstag=&amp;amp;Date_of_today.-1;&lt;/P&gt;&lt;P&gt;______________&lt;/P&gt;&lt;P&gt;180&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;38&lt;/P&gt;&lt;P&gt;39&amp;nbsp;%put &amp;amp;Auswertungstag.;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference AUSWERTUNGSTAG not resolved.&lt;/P&gt;&lt;P&gt;&amp;amp;Auswertungstag.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what do I do wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can someone send me the correct script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks a lot for any help&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;PY&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>Thu, 16 Jan 2020 11:00:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macro-fail-correction-needed/m-p/617719#M19119</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2020-01-16T11:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: macro fail - correction needed</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macro-fail-correction-needed/m-p/617721#M19120</link>
      <description>&lt;P&gt;You are missing the %let-statement and %eval - in macro language required to perform calculations. So&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Auswertungstag=&amp;amp;Date_of_today.-1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;should be&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Auswertungstag= %eval(&amp;amp;Date_of_today.-1);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Jan 2020 11:21:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macro-fail-correction-needed/m-p/617721#M19120</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-01-16T11:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: macro fail - correction needed</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macro-fail-correction-needed/m-p/617727#M19121</link>
      <description>&lt;P&gt;First of all, these are just simple macro variable assignments, you do not need a macro definition for that.&lt;/P&gt;
&lt;P&gt;You can do it in open code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Date_of_today=%sysfunc(today());
%let Auswertungstag=%eval(&amp;amp;Date_of_today.-1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;so you also don't need the %global statement (which is missing in your second macro, causing&amp;nbsp;&lt;SPAN&gt;WARNING: Apparent symbolic reference AUSWERTUNGSTAG not resolved).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you find you need that repeatedly, put it in your autoexec, or save it as a .sas file to use in a %include.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 11:57:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macro-fail-correction-needed/m-p/617727#M19121</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-16T11:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: macro fail - correction needed</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macro-fail-correction-needed/m-p/617731#M19122</link>
      <description>thanks a lot</description>
      <pubDate>Thu, 16 Jan 2020 12:11:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macro-fail-correction-needed/m-p/617731#M19122</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2020-01-16T12:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: macro fail - correction needed</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macro-fail-correction-needed/m-p/618015#M19159</link>
      <description>Danke dir&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Jan 2020 06:59:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macro-fail-correction-needed/m-p/618015#M19159</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2020-01-17T06:59:43Z</dc:date>
    </item>
  </channel>
</rss>

