<?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 Do Loop Iteration in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Do-Loop-Iteration/m-p/172471#M301638</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this, may help in understanding the concept.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naeem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options symbolgen;&lt;BR /&gt;%MACRO LOOPCHK;&lt;BR /&gt;%DO I=1 %TO 10;&lt;BR /&gt;%PUT I=&amp;amp;I;&lt;BR /&gt;%END;&lt;BR /&gt;%MEND LOOPCHK;&lt;BR /&gt;%LOOPCHK;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;options symbolgen;&lt;BR /&gt;%MACRO LOOPCHK;&lt;BR /&gt;%let I=1;&lt;BR /&gt;%DO&amp;nbsp; %while (&amp;amp;I&amp;lt;=10);&lt;BR /&gt;%PUT I=&amp;amp;I;&lt;BR /&gt;%let I=%eval(&amp;amp;I+1);&lt;BR /&gt;%END;&lt;BR /&gt;%MEND LOOPCHK;&lt;BR /&gt;%LOOPCHK;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 May 2014 14:39:48 GMT</pubDate>
    <dc:creator>stat_sas</dc:creator>
    <dc:date>2014-05-26T14:39:48Z</dc:date>
    <item>
      <title>Macro Do Loop Iteration</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Do-Loop-Iteration/m-p/172466#M301633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;All - &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;I knew that we can't perform arithmetic operation directly on the macro variables, if we have to perform the same then we need to use either %EVAL or %SYSEVALF macro functions. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;%LET A=3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;%LET B=4;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;%LET SUM=&amp;amp;A+&amp;amp;B;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;%PUT SUM=&amp;amp;SUM.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;%LET SUM=%EVAL(&amp;amp;A+&amp;amp;B);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;%PUT SUM=&amp;amp;SUM.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;But if you look at the below code, the do loop iterating 10 times through the %put statement without even incrementing the counter i by 1. Can anyone explain how this is happening.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;%MACRO LOOPCHK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;%DO I=1 %TO 10;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;%PUT I=&amp;amp;I;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;%END;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;%MEND LOOPCHK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;%LOOPCHK;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 May 2014 14:29:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Do-Loop-Iteration/m-p/172466#M301633</guid>
      <dc:creator>dhana</dc:creator>
      <dc:date>2014-05-25T14:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Do Loop Iteration</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Do-Loop-Iteration/m-p/172467#M301634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have something else wrong somewhere, all of your code above works as expected..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; %MACRO LOOPCHK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp; %DO I=1 %TO 10;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp; %PUT I=&amp;amp;I;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp; %END;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;6&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;7&amp;nbsp;&amp;nbsp;&amp;nbsp; %MEND LOOPCHK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;8&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;9&amp;nbsp;&amp;nbsp;&amp;nbsp; %LOOPCHK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;I=1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;I=2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;I=3&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;I=4&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;I=5&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;I=6&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;I=7&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;I=8&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;I=9&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;I=10&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;10&amp;nbsp;&amp;nbsp; %LET A=3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;11&amp;nbsp;&amp;nbsp; %LET B=4;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;12&amp;nbsp;&amp;nbsp; %LET SUM=&amp;amp;A+&amp;amp;B;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;13&amp;nbsp;&amp;nbsp; %PUT SUM=&amp;amp;SUM.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;SUM=3+4&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;14&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;15&amp;nbsp;&amp;nbsp; %LET SUM=%EVAL(&amp;amp;A+&amp;amp;B);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;16&amp;nbsp;&amp;nbsp; %PUT SUM=&amp;amp;SUM.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;SUM=7&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 May 2014 18:53:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Do-Loop-Iteration/m-p/172467#M301634</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-05-25T18:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Do Loop Iteration</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Do-Loop-Iteration/m-p/172468#M301635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;Reeza, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;I don't have problem with my code. My question is when we need macro functions like evalf &amp;amp; sysevalf to perform arithmetic operation, how the same is performed without any macro functions in %do loop macro statement.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2014 04:55:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Do-Loop-Iteration/m-p/172468#M301635</guid>
      <dc:creator>dhana</dc:creator>
      <dc:date>2014-05-26T04:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Do Loop Iteration</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Do-Loop-Iteration/m-p/172469#M301636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is just a function of the iterative %do. It does the increment implicitly.&lt;/P&gt;&lt;P&gt;You probably miss the constructs you would expect in a C language "for" statement. (initialize, increment, end condition)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2014 07:17:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Do-Loop-Iteration/m-p/172469#M301636</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-05-26T07:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Do Loop Iteration</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Do-Loop-Iteration/m-p/172470#M301637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By Default, SAS will take &lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; background-color: #ffffff;"&gt;%DO I=1 %TO 10;&amp;nbsp; I&lt;/SPAN&gt; as Integer&amp;nbsp; just like&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; background-color: #ffffff;"&gt;%DO&amp;nbsp; %eval( I=1 ) %TO&amp;nbsp; %eval(10) ; You can find it in Macro Documentation. if I is double or float , this wouldn't work . you need %sysevalf() around it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2014 13:12:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Do-Loop-Iteration/m-p/172470#M301637</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-05-26T13:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Do Loop Iteration</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Do-Loop-Iteration/m-p/172471#M301638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this, may help in understanding the concept.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naeem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options symbolgen;&lt;BR /&gt;%MACRO LOOPCHK;&lt;BR /&gt;%DO I=1 %TO 10;&lt;BR /&gt;%PUT I=&amp;amp;I;&lt;BR /&gt;%END;&lt;BR /&gt;%MEND LOOPCHK;&lt;BR /&gt;%LOOPCHK;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;options symbolgen;&lt;BR /&gt;%MACRO LOOPCHK;&lt;BR /&gt;%let I=1;&lt;BR /&gt;%DO&amp;nbsp; %while (&amp;amp;I&amp;lt;=10);&lt;BR /&gt;%PUT I=&amp;amp;I;&lt;BR /&gt;%let I=%eval(&amp;amp;I+1);&lt;BR /&gt;%END;&lt;BR /&gt;%MEND LOOPCHK;&lt;BR /&gt;%LOOPCHK;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2014 14:39:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Do-Loop-Iteration/m-p/172471#M301638</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-05-26T14:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Do Loop Iteration</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Do-Loop-Iteration/m-p/172472#M301639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;Thank you Ksharp, stat@sas, Reeza and KurtBremser for your replies and insight on how this implicit looping works.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 May 2014 16:18:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Do-Loop-Iteration/m-p/172472#M301639</guid>
      <dc:creator>dhana</dc:creator>
      <dc:date>2014-05-26T16:18:22Z</dc:date>
    </item>
  </channel>
</rss>

