<?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 using macro in do loop in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/using-macro-in-do-loop/m-p/431115#M106586</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I couldn't figure out what i am doing wrong in the below code but basically I am trying to&amp;nbsp;get day from today's date and use that as "start" value for the do loop iteration.&amp;nbsp; Could someone tell me why this isn't working? Thank You!&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%macro test;&lt;BR /&gt;%do n =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;%sysfunc(day(%sysfunc(today())-1))&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;%to 20 by -1;&lt;BR /&gt;/*%do n = 24 %to 20;*/&lt;BR /&gt;%Let n1 = %eval(&amp;amp;n.- 1);&lt;BR /&gt;%put N1 =&amp;gt; &amp;amp;n1.;&lt;BR /&gt;%end;&lt;/P&gt;
&lt;P&gt;%mend;&lt;BR /&gt;%test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: 23 by -1&lt;BR /&gt;ERROR: The %TO value of the %DO N loop is invalid.&lt;BR /&gt;ERROR: The macro AA will stop executing.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jan 2018 22:06:31 GMT</pubDate>
    <dc:creator>vicky07</dc:creator>
    <dc:date>2018-01-25T22:06:31Z</dc:date>
    <item>
      <title>using macro in do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-macro-in-do-loop/m-p/431115#M106586</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I couldn't figure out what i am doing wrong in the below code but basically I am trying to&amp;nbsp;get day from today's date and use that as "start" value for the do loop iteration.&amp;nbsp; Could someone tell me why this isn't working? Thank You!&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%macro test;&lt;BR /&gt;%do n =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;%sysfunc(day(%sysfunc(today())-1))&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;%to 20 by -1;&lt;BR /&gt;/*%do n = 24 %to 20;*/&lt;BR /&gt;%Let n1 = %eval(&amp;amp;n.- 1);&lt;BR /&gt;%put N1 =&amp;gt; &amp;amp;n1.;&lt;BR /&gt;%end;&lt;/P&gt;
&lt;P&gt;%mend;&lt;BR /&gt;%test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: 23 by -1&lt;BR /&gt;ERROR: The %TO value of the %DO N loop is invalid.&lt;BR /&gt;ERROR: The macro AA will stop executing.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 22:06:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-macro-in-do-loop/m-p/431115#M106586</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2018-01-25T22:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: using macro in do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-macro-in-do-loop/m-p/431116#M106587</link>
      <description>&lt;P&gt;A quick look at your code tells me you are missing &lt;STRONG&gt;%by&lt;/STRONG&gt; instead of by&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 22:09:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-macro-in-do-loop/m-p/431116#M106587</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-25T22:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: using macro in do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-macro-in-do-loop/m-p/431117#M106588</link>
      <description>&lt;P&gt;I ran a test after the change i made, here is the log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1185 %macro test;&lt;BR /&gt;1186 %do n = %sysfunc(day(%sysfunc(today())-1)) %to 20&lt;STRONG&gt; %by&lt;/STRONG&gt; -1;&lt;BR /&gt;1187 /*%do n = 24 %to 20;*/&lt;BR /&gt;1188 %Let n1 = %eval(&amp;amp;n.- 1);&lt;BR /&gt;1189 %put N1 =&amp;gt; &amp;amp;n1.;&lt;BR /&gt;1190 %end;&lt;BR /&gt;1191&lt;BR /&gt;1192 %mend;&lt;BR /&gt;1193 %test;&lt;BR /&gt;&lt;STRONG&gt;N1 =&amp;gt; 23&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;N1 =&amp;gt; 22&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;N1 =&amp;gt; 21&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;N1 =&amp;gt; 20&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;N1 =&amp;gt; 19&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 22:13:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-macro-in-do-loop/m-p/431117#M106588</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-25T22:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: using macro in do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-macro-in-do-loop/m-p/431122#M106589</link>
      <description>&lt;P&gt;I knew i was doing something silly. Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 22:34:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-macro-in-do-loop/m-p/431122#M106589</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2018-01-25T22:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: using macro in do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-macro-in-do-loop/m-p/431138#M106591</link>
      <description>&lt;P&gt;I hope you are testing that day(today()) is greater than 20 before executing else you will have an infinite loop.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 00:38:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-macro-in-do-loop/m-p/431138#M106591</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-01-26T00:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: using macro in do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-macro-in-do-loop/m-p/431292#M106656</link>
      <description>It will be actually1. I put 20 for illustration purpose. Thanks.</description>
      <pubDate>Fri, 26 Jan 2018 15:13:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-macro-in-do-loop/m-p/431292#M106656</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2018-01-26T15:13:23Z</dc:date>
    </item>
  </channel>
</rss>

