<?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 multiple execution of macro with parameters stored in dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115974#M23922</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to execute&amp;nbsp; macro with parameters many times.&lt;/P&gt;&lt;P&gt;Parameters for subsequent executions are stored in data set.&lt;/P&gt;&lt;P&gt;Is there a simple way (other than CALL EXECUTE) to go through data set and execute macro with proper parameters?&lt;/P&gt;&lt;P&gt;I tried&amp;nbsp; CALL EXECUTE but this method seems non-deterministic - macro itself executes but from CALL EXECUTE returns many errors.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 May 2012 17:28:36 GMT</pubDate>
    <dc:creator>tom12122</dc:creator>
    <dc:date>2012-05-15T17:28:36Z</dc:date>
    <item>
      <title>multiple execution of macro with parameters stored in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115974#M23922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to execute&amp;nbsp; macro with parameters many times.&lt;/P&gt;&lt;P&gt;Parameters for subsequent executions are stored in data set.&lt;/P&gt;&lt;P&gt;Is there a simple way (other than CALL EXECUTE) to go through data set and execute macro with proper parameters?&lt;/P&gt;&lt;P&gt;I tried&amp;nbsp; CALL EXECUTE but this method seems non-deterministic - macro itself executes but from CALL EXECUTE returns many errors.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 17:28:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115974#M23922</guid>
      <dc:creator>tom12122</dc:creator>
      <dc:date>2012-05-15T17:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: multiple execution of macro with parameters stored in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115975#M23923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well you could nest your macros and call it that way, but that's what call execute is designed for. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 17:39:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115975#M23923</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-05-15T17:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: multiple execution of macro with parameters stored in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115976#M23924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL EXECUTE will be tricky, because the macro statements that it generates execute immediately.&amp;nbsp; Only the SAS language statements wait for the current DATA step to finish.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could try either of two methods.&amp;nbsp; CALL EXECUTE will probably work if you generate a slightly different set of code.&amp;nbsp; Instead of generating %MYMAC (parameters), generate %nrstr(%MYMAC (parameters)).&amp;nbsp; That will probably do the trick.&amp;nbsp; But if not, you could go back to the old-fashioned way.&amp;nbsp; Have the DATA step that currently uses CALL EXECUTE write out the macro calls to a file using FILE and PUT statements.&amp;nbsp; Then %include the file after the DATA step is over.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 18:11:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115976#M23924</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-05-15T18:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: multiple execution of macro with parameters stored in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115977#M23925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried %nrstr but macro istself executes ok but with call execute returns still errors.&lt;/P&gt;&lt;P&gt;I have some call symput statements in macros 2 levels under which according to documentation are not allowed. I tried to put variable as PROC SQL; SELECT A INTO :A FROM X but still call execute seems indeterministic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought about concatenating parameters (to paramters column) and also adding _N_ column with data step. Then I'll try executing inside %do %while statement as %my_macro(&amp;amp;parameters) getting &amp;amp;paramteres from proper record with proc sql;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If someone has any other ideas to do that without CALL EXECUTE I'll appreciate help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 18:22:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115977#M23925</guid>
      <dc:creator>tom12122</dc:creator>
      <dc:date>2012-05-15T18:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: multiple execution of macro with parameters stored in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115978#M23926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well, you'll have to show us some of the error messages if you would like help debugging it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL SYMPUT is definitely allowed within a macro definition.&amp;nbsp; (It's a CARDS statement that will give you an error.)&amp;nbsp; The tricky issue with CALL SYMPUT inside a macro definition is figuring out which symbol table is being used.&amp;nbsp; But it's too early to say whether that would be a problem for your program.&lt;/P&gt;&lt;P&gt;And it is still possible to switch to the FILE / PUT statement approach.&amp;nbsp; At least that will make it clearer which errors are generated by the DATA step that now contains the CALL EXECUTEs, vs. which are caused by executing the macros.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 18:42:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115978#M23926</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-05-15T18:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: multiple execution of macro with parameters stored in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115979#M23927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok. I'll put error messages as soon as I have access to code at work..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Generally the problem is that macro produces errors that some macro variables couldn't be resolved and some other variables resolve to eg. "n inestead of n (when executed normally) - i use some proc sql statements inside macro called by call execute. I use some where conditions based on macro variables. &lt;/P&gt;&lt;P&gt;I also concatenate values so generally mess with " and ' might be an issue here - correct me if i'm wrong.&lt;/P&gt;&lt;P&gt;But still macro executes ok itself and from call execute executes in a different way - i need to get code that i trust and is deterministic.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 20:36:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115979#M23927</guid>
      <dc:creator>tom12122</dc:creator>
      <dc:date>2012-05-15T20:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: multiple execution of macro with parameters stored in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115980#M23928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I do this often. As long as your macro behaves, this should work. hth&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Consolas; font-size: 90%; line-height: 1.1;"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; args;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a=&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;; b=&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;&lt;STRONG&gt;11&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;; c=&lt;/SPAN&gt;&lt;SPAN style="color: #800080;"&gt;"one&amp;nbsp; "&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;output&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a=&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;; b=&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;&lt;STRONG&gt;22&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;; c=&lt;/SPAN&gt;&lt;SPAN style="color: #800080;"&gt;"two&amp;nbsp; "&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;output&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a=&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;; b=&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;&lt;STRONG&gt;33&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;; c=&lt;/SPAN&gt;&lt;SPAN style="color: #800080;"&gt;"three"&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;output&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; doOne(a, b, c);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;%put&lt;/SPAN&gt;&lt;SPAN&gt; a=&amp;amp;a b=&amp;amp;b c=&amp;amp;c;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; doOne;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; doAll(data=);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;%local&lt;/SPAN&gt;&lt;SPAN&gt; dsid rc OK a b c;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;%let&lt;/SPAN&gt;&lt;SPAN&gt; OK = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;%let&lt;/SPAN&gt;&lt;SPAN&gt; dsid = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN&gt;(open(&amp;amp;data,i));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;%syscall&lt;/SPAN&gt;&lt;SPAN&gt; set(dsid);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;%do&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;%while&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN&gt;(fetch(&amp;amp;dsid))=&amp;amp;OK);&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;*;&lt;/SPAN&gt;&lt;SPAN&gt;%&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;SPAN&gt;doOne&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;(&amp;amp;a, &amp;amp;b, &amp;amp;c)&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;%end&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;%let&lt;/SPAN&gt;&lt;SPAN&gt; rc = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN&gt;(close(&amp;amp;dsid)); &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; doAll;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;*-- check --*;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; %&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;SPAN&gt;doAll&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;(data=args)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;*-- on log&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000;"&gt;&amp;nbsp; a=1 b=11 c=one&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000;"&gt;&amp;nbsp; a=2 b=22 c=two&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000;"&gt;&amp;nbsp; a=3 b=33 c=three&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000;"&gt;&amp;nbsp; --*;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 20:50:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115980#M23928</guid>
      <dc:creator>chang_y_chung_hotmail_com</dc:creator>
      <dc:date>2012-05-15T20:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: multiple execution of macro with parameters stored in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115981#M23929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you want to use call execute use %nrstr to have it execute after the datastep completes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data args;&lt;/P&gt;&lt;P&gt;a = 1; b = 11; c = "one&amp;nbsp; "; output;&lt;/P&gt;&lt;P&gt;a = 2; b = 22; c = "two&amp;nbsp; "; output;&lt;/P&gt;&lt;P&gt;a = 3; b = 33; c = "three"; output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro mymacro( a , b , c );&lt;/P&gt;&lt;P&gt;%put &amp;amp;c : a=&amp;amp;a b=&amp;amp;b;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;set args;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call execute('%nrstr(%mymacro(' || a || ',' || b || ',' || c || '));');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: CALL EXECUTE generated line.&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +&amp;nbsp; %mymacro(&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11,one&amp;nbsp; );&lt;/P&gt;&lt;P&gt;one : a=1 b=11&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +&amp;nbsp; %mymacro(&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22,two&amp;nbsp; );&lt;/P&gt;&lt;P&gt;two : a=2 b=22&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +&amp;nbsp; %mymacro(&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 33,three);&lt;/P&gt;&lt;P&gt;three : a=3 b=33&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;You could also build an include file instead:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename x temp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;set args;&lt;/P&gt;&lt;P&gt;file x;&lt;/P&gt;&lt;P&gt;put '%mymacro(' a ',' b ',' c ');';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%include "%sysfunc(pathname(x))" /source2;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 21:16:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115981#M23929</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2012-05-15T21:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: multiple execution of macro with parameters stored in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115982#M23930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The only thing I can think is using macro variable matrix .&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;PRE&gt;data args;
a = 1; b = 11; c = "one&amp;nbsp; "; output;
a = 2; b = 22; c = "two&amp;nbsp; "; output;
a = 3; b = 33; c = "three"; output;
run;

%macro mymacro( a , b , c );
%put &amp;amp;c : a=&amp;amp;a b=&amp;amp;b;
%mend;


proc sql noprint;
select count(*) into : n from args;
select a,b,c
&amp;nbsp;&amp;nbsp; into : a1 - : a%left(&amp;amp;n) ,
&amp;nbsp;&amp;nbsp;&amp;nbsp; : b1 - : b%left(&amp;amp;n) ,
&amp;nbsp;&amp;nbsp;&amp;nbsp; : c1 - : c%left(&amp;amp;n) from args;
quit;

%macro execute;
%do i=1 %to &amp;amp;n;
 %mymacro(&amp;amp;&amp;amp;a&amp;amp;i,&amp;amp;&amp;amp;b&amp;amp;i, &amp;amp;&amp;amp;c&amp;amp;i )
%end;
%mend execute;

%execute


&lt;/PRE&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;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 02:11:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115982#M23930</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-05-16T02:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: multiple execution of macro with parameters stored in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115983#M23931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I find that using a data step to generate the code is the easiest.&amp;nbsp; You can generate code. Look at it. Run a few lines. Until you get it working.&amp;nbsp; Then run it for real using %INCLUDE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;filename code temp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set sashelp.class;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put '%mymacro(' name ',' sex ')' ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%include code / source2;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 02:44:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiple-execution-of-macro-with-parameters-stored-in-dataset/m-p/115983#M23931</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-05-16T02:44:34Z</dc:date>
    </item>
  </channel>
</rss>

