<?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 how to make a do loop for running the same macro for multiple times for different variables ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-make-a-do-loop-for-running-the-same-macro-for-multiple/m-p/548718#M152199</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First of all, excuse my english, i'm a french student !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I find many things on internet but i have a little problem. I want to execute a macro programm many times with differents parameters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code i make with the help of internet and of another subject : &lt;A href="https://communities.sas.com/t5/SAS-Programming/how-to-make-a-do-loop-for-running-the-same-code-multiple-times/td-p/287300" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/how-to-make-a-do-loop-for-running-the-same-code-multiple-times/td-p/287300&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro run_macro (typequest =,nom_fichier_csv=);

%DO i = 1 %to %sysfunc(countw(&amp;amp;typequest));

%let nextvar = %scan(&amp;amp;typequest, &amp;amp;i);
%let nextchemin = %scan(&amp;amp;nom_fichier_csv, &amp;amp;i);

%cim_eer_ev (typequest = &amp;amp;nextvar
,chemin_fichier = &amp;amp;nextchemin
,jour_fin_trim_precedent = &amp;amp;mois_fin_trim_precedent
,mois_fin_trim_precedent = &amp;amp;jour_fin_trim_precedent
,annee_fin_trim_precedent = &amp;amp;annee_fin_trim_precedent )

%END ;

%mend run_macro ;


%run_macro(typequest = cim eer
,nom_fichier_csv= cim_all eer_all
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It's run well for the first parameters : cim and cim all, but it doesn't loop on the second part (eer and eer_all)...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Someone have an idea ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you and really sorry for my english !!&lt;/P&gt;</description>
    <pubDate>Fri, 05 Apr 2019 09:13:50 GMT</pubDate>
    <dc:creator>Onizuka</dc:creator>
    <dc:date>2019-04-05T09:13:50Z</dc:date>
    <item>
      <title>how to make a do loop for running the same macro for multiple times for different variables ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-make-a-do-loop-for-running-the-same-macro-for-multiple/m-p/548718#M152199</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First of all, excuse my english, i'm a french student !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I find many things on internet but i have a little problem. I want to execute a macro programm many times with differents parameters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code i make with the help of internet and of another subject : &lt;A href="https://communities.sas.com/t5/SAS-Programming/how-to-make-a-do-loop-for-running-the-same-code-multiple-times/td-p/287300" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/how-to-make-a-do-loop-for-running-the-same-code-multiple-times/td-p/287300&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro run_macro (typequest =,nom_fichier_csv=);

%DO i = 1 %to %sysfunc(countw(&amp;amp;typequest));

%let nextvar = %scan(&amp;amp;typequest, &amp;amp;i);
%let nextchemin = %scan(&amp;amp;nom_fichier_csv, &amp;amp;i);

%cim_eer_ev (typequest = &amp;amp;nextvar
,chemin_fichier = &amp;amp;nextchemin
,jour_fin_trim_precedent = &amp;amp;mois_fin_trim_precedent
,mois_fin_trim_precedent = &amp;amp;jour_fin_trim_precedent
,annee_fin_trim_precedent = &amp;amp;annee_fin_trim_precedent )

%END ;

%mend run_macro ;


%run_macro(typequest = cim eer
,nom_fichier_csv= cim_all eer_all
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It's run well for the first parameters : cim and cim all, but it doesn't loop on the second part (eer and eer_all)...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Someone have an idea ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you and really sorry for my english !!&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 09:13:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-make-a-do-loop-for-running-the-same-macro-for-multiple/m-p/548718#M152199</guid>
      <dc:creator>Onizuka</dc:creator>
      <dc:date>2019-04-05T09:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to make a do loop for running the same macro for multiple times for different variables ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-make-a-do-loop-for-running-the-same-macro-for-multiple/m-p/548721#M152201</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;You don't show the code for macro cim_eer_ev. I suspect that this macro also uses a macrovariable counter &amp;amp;i that overrides the one you use in run_macro. To avoid this type of problem, you have to declare i as %local in each macro.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 09:29:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-make-a-do-loop-for-running-the-same-macro-for-multiple/m-p/548721#M152201</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2019-04-05T09:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to make a do loop for running the same macro for multiple times for different variables ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-make-a-do-loop-for-running-the-same-macro-for-multiple/m-p/548725#M152205</link>
      <description>&lt;P&gt;Thank you very much, it is working perfectly !!! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 10:18:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-make-a-do-loop-for-running-the-same-macro-for-multiple/m-p/548725#M152205</guid>
      <dc:creator>Onizuka</dc:creator>
      <dc:date>2019-04-05T10:18:34Z</dc:date>
    </item>
  </channel>
</rss>

