<?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: Looping a macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Looping-a-macro/m-p/600278#M173459</link>
    <description>&lt;P&gt;If you want an increment other than 1, use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%by&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 30 Oct 2019 07:29:02 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-10-30T07:29:02Z</dc:date>
    <item>
      <title>Looping a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-a-macro/m-p/600277#M173458</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a macro "microsim" with 2 parameters, which are a starting year and an ending year. I want to loop this macro by increasing the year by 5 from 2010 until 2060.&lt;/P&gt;
&lt;P&gt;In other words, the loop should do:&lt;/P&gt;
&lt;P&gt;%microsim(2010,2015);&lt;BR /&gt;%microsim(2015,2020);&lt;BR /&gt;%microsim(2020,2025);&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;%microsim(2055,2060);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was thinking to do something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro loop(start,end);
   %local year;
   %do year = &amp;amp;start %to &amp;amp;end;
      %microsim (&amp;amp;start, %eval(&amp;amp;year+5))
   %end;

%mend loop;&lt;BR /&gt;%loop(2010, 2060);&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But the do statement increases by 1 while I want by 5;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 07:26:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-a-macro/m-p/600277#M173458</guid>
      <dc:creator>Demographer</dc:creator>
      <dc:date>2019-10-30T07:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-a-macro/m-p/600278#M173459</link>
      <description>&lt;P&gt;If you want an increment other than 1, use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%by&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Oct 2019 07:29:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-a-macro/m-p/600278#M173459</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-30T07:29:02Z</dc:date>
    </item>
  </channel>
</rss>

