<?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 Is there a way to loop through a series of like parameters? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-loop-through-a-series-of-like-parameters/m-p/437798#M109092</link>
    <description>&lt;P&gt;&lt;BR /&gt;%macro combineYears(Year1, Year2, Year3, Year4, Year5);&lt;/P&gt;
&lt;P&gt;do year1 to year5;&lt;/P&gt;
&lt;P&gt;/*process logic*/&lt;/P&gt;
&lt;P&gt;end;&lt;BR /&gt;%end;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Feb 2018 22:04:47 GMT</pubDate>
    <dc:creator>DavidPhillips2</dc:creator>
    <dc:date>2018-02-15T22:04:47Z</dc:date>
    <item>
      <title>Is there a way to loop through a series of like parameters?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-loop-through-a-series-of-like-parameters/m-p/437798#M109092</link>
      <description>&lt;P&gt;&lt;BR /&gt;%macro combineYears(Year1, Year2, Year3, Year4, Year5);&lt;/P&gt;
&lt;P&gt;do year1 to year5;&lt;/P&gt;
&lt;P&gt;/*process logic*/&lt;/P&gt;
&lt;P&gt;end;&lt;BR /&gt;%end;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 22:04:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-loop-through-a-series-of-like-parameters/m-p/437798#M109092</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2018-02-15T22:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to loop through a series of like parameters?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-loop-through-a-series-of-like-parameters/m-p/437804#M109095</link>
      <description>&lt;P&gt;Yes, but it would be easier if you get rid of the commas between the values.&amp;nbsp; Here's some documentation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sastraining/2015/01/30/sas-authors-tip-getting-the-macro-language-to-perform-a-do-loop-over-a-list-of-values/" target="_blank"&gt;https://blogs.sas.com/content/sastraining/2015/01/30/sas-authors-tip-getting-the-macro-language-to-perform-a-do-loop-over-a-list-of-values/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 22:14:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-loop-through-a-series-of-like-parameters/m-p/437804#M109095</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-02-15T22:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to loop through a series of like parameters?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-loop-through-a-series-of-like-parameters/m-p/437809#M109097</link>
      <description>&lt;P&gt;&amp;nbsp;Depends on how you want to use it. You may end up finding that a %DO loop may work just as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also check out examples &amp;nbsp;3 and 4 here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Appendix/ta-p/291716" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Appendix/ta-p/291716&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 22:24:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-loop-through-a-series-of-like-parameters/m-p/437809#M109097</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-15T22:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to loop through a series of like parameters?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-loop-through-a-series-of-like-parameters/m-p/437922#M109131</link>
      <description>&lt;P&gt;It can be done as follows.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro combineYears(Year1, Year2, Year3, Year4, Year5);
%do i=1 %to 5;
	%put year= &amp;amp;&amp;amp;year&amp;amp;i;
	/*process logic*/
%end;
%mend combineYears;

%combineYears(2000, 2001, 2010, 2015, 2018);


*LOG

year= 2000
year= 2001
year= 2010
year= 2015
year= 2018&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It will be good if you also pass the number of years you are passing and use to loop control.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let us know if it helped.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 09:45:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-loop-through-a-series-of-like-parameters/m-p/437922#M109131</guid>
      <dc:creator>Satish_Parida</dc:creator>
      <dc:date>2018-02-16T09:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to loop through a series of like parameters?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-loop-through-a-series-of-like-parameters/m-p/438069#M109189</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138619"&gt;@Satish_Parida&lt;/a&gt;&amp;nbsp;your approach, while it will work would have issues if the user only wants to process 2 years and would require a diffent macro to process any different number of year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt; meant by getting rid of commas:&lt;/P&gt;
&lt;PRE&gt;%macro combineYears(YearList);
%do i=1 %to %sysfunc(countw(&amp;amp;yearlist));
	%put year= %scan(&amp;amp;yearlist,&amp;amp;i);
  
	/*process logic*/
%end;
%mend combineYears;

%combineYears(2000 2001 2010 2015 2018);

&lt;/PRE&gt;
&lt;P&gt;which will process any explicit list of one or more items. Note that we have no check for and empty list though nothing inside the %do loop will happen so likely okay for that, or checks to ensure that the values in the list are valid for any other purpose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 20:43:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-a-way-to-loop-through-a-series-of-like-parameters/m-p/438069#M109189</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-16T20:43:31Z</dc:date>
    </item>
  </channel>
</rss>

