<?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: Create loop for running existing macros in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-loop-for-running-existing-macros/m-p/455654#M115305</link>
    <description>&lt;P&gt;CALL EXECUTE.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use a data step loop to create your dates and then call the macro once for each date.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once your STR variable looks like the correct code (%fcf(date);) then you can uncomment the call execute str and it will execute the str.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data call_macro;

do date='01Jan2018'd to '31Dec2018'd;
str = catt('%fcf(', put(date, date9.), ');');
*call execute (str);
end;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/123179"&gt;@india2016&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hello All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I am stuck while creating macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have one macro and want&amp;nbsp;to run this macro 52 times with 52 dates so I should create one macro that will run existing macro for 52 dates but I have that are in disorder( e.g. 20171213, 20171215,20171219).But I can write manually.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Want&amp;nbsp;create TEST&amp;nbsp;macro which will run existing macro..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTES:&lt;/P&gt;
&lt;P&gt;1) FCF macro will take date one by one and create multiple datasets ..&lt;/P&gt;
&lt;P&gt;2) TEST macro wants to create that run 52 times..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%fcf;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%mend fcf;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%mend test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So how should I give these 52 dates in my macro so that existing macro will take all values and run for that dates.Should I give keyword parameter macro? with 52 dates and that will run for all dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Apr 2018 16:08:52 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-04-19T16:08:52Z</dc:date>
    <item>
      <title>Create loop for running existing macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-loop-for-running-existing-macros/m-p/455652#M115304</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I am stuck while creating macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have one macro and want&amp;nbsp;to run this macro 52 times with 52 dates so I should create one macro that will run existing macro for 52 dates but I have that are in disorder( e.g. 20171213, 20171215,20171219).But I can write manually.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Want&amp;nbsp;create TEST&amp;nbsp;macro which will run existing macro..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTES:&lt;/P&gt;&lt;P&gt;1) FCF macro will take date one by one and create multiple datasets ..&lt;/P&gt;&lt;P&gt;2) TEST macro wants to create that run 52 times..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%fcf;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%mend fcf;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%mend test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So how should I give these 52 dates in my macro so that existing macro will take all values and run for that dates.Should I give keyword parameter macro? with 52 dates and that will run for all dates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 16:00:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-loop-for-running-existing-macros/m-p/455652#M115304</guid>
      <dc:creator>india2016</dc:creator>
      <dc:date>2018-04-19T16:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: Create loop for running existing macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-loop-for-running-existing-macros/m-p/455654#M115305</link>
      <description>&lt;P&gt;CALL EXECUTE.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use a data step loop to create your dates and then call the macro once for each date.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once your STR variable looks like the correct code (%fcf(date);) then you can uncomment the call execute str and it will execute the str.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data call_macro;

do date='01Jan2018'd to '31Dec2018'd;
str = catt('%fcf(', put(date, date9.), ');');
*call execute (str);
end;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/123179"&gt;@india2016&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hello All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I am stuck while creating macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have one macro and want&amp;nbsp;to run this macro 52 times with 52 dates so I should create one macro that will run existing macro for 52 dates but I have that are in disorder( e.g. 20171213, 20171215,20171219).But I can write manually.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Want&amp;nbsp;create TEST&amp;nbsp;macro which will run existing macro..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTES:&lt;/P&gt;
&lt;P&gt;1) FCF macro will take date one by one and create multiple datasets ..&lt;/P&gt;
&lt;P&gt;2) TEST macro wants to create that run 52 times..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%fcf;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%mend fcf;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%mend test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So how should I give these 52 dates in my macro so that existing macro will take all values and run for that dates.Should I give keyword parameter macro? with 52 dates and that will run for all dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 16:08:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-loop-for-running-existing-macros/m-p/455654#M115305</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-19T16:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: Create loop for running existing macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-loop-for-running-existing-macros/m-p/455655#M115306</link>
      <description>&lt;P&gt;This might be helpful:&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;</description>
      <pubDate>Thu, 19 Apr 2018 16:12:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-loop-for-running-existing-macros/m-p/455655#M115306</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-19T16:12:03Z</dc:date>
    </item>
  </channel>
</rss>

