<?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: Macro statements as a macro parameter value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558718#M155956</link>
    <description>&lt;P&gt;Quentin,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Good to hear from you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I surmised the same, but you said it so much more fluently.&amp;nbsp; I was thinking of a macro writing a macro, but it failed.&amp;nbsp; I got further with data _null_ and call execute(), but not far enough.&amp;nbsp; At least I pushed my SAS knowledge today.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kevin&lt;/P&gt;</description>
    <pubDate>Tue, 14 May 2019 17:56:07 GMT</pubDate>
    <dc:creator>KevinViel</dc:creator>
    <dc:date>2019-05-14T17:56:07Z</dc:date>
    <item>
      <title>Macro statements as a macro parameter value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558690#M155935</link>
      <description>&lt;P&gt;Can a macro statement (%IF-%THEN, for instance) be a value of a macro parameter?&amp;nbsp; For instance, might I do something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;, define_option = %nrstr( %%if &amp;amp;__i. &amp;gt; 1 and %%sysfunc( mod( &amp;amp;__i. , 4 ) = 1 %%then do page; )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I might not need the double %% signs, but it occurred to that the macro facility writes code, not macro.&amp;nbsp; This might be an example of when to nest a macro definition inside a macro, the elusive beast against which we were warned back in the heyday of SAS-L?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kevin&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 16:40:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558690#M155935</guid>
      <dc:creator>KevinViel</dc:creator>
      <dc:date>2019-05-14T16:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Macro statements as a macro parameter value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558698#M155941</link>
      <description>&lt;P&gt;I think the answer to your question:&amp;nbsp;&lt;SPAN&gt;Can a macro statement be a value of a macro parameter?" is clearly yes.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let gender=F;
%let abc=%nrstr(%if &amp;amp;gender=F %then %put &amp;amp;gender;);
%put &amp;amp;=gender;
%put &amp;amp;=abc;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;However, depending on what you are trying to do, this may not be the best way to achieve your goal.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 16:55:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558698#M155941</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-05-14T16:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Macro statements as a macro parameter value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558701#M155944</link>
      <description>&lt;P&gt;Paige,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Thank you for a prompt reply.&amp;nbsp; The distinction is that those are macro VARIABLES, where parameters pertain to the macro statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;19 %macro test&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;20 ( parameter = %str()) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;21 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;22 %let variable = 1 ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;23 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;24 data _null_ ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;25 %if %nrbquote(&amp;amp;parameter.) ne %str() %then &amp;amp;parameter. ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;26 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;27 %if &amp;amp;variable. = 1 %then put "The test is Good!" %str(;) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;28 run ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;29 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;30 %mend test ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;31 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;32 %test ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;MPRINT(TEST): data _null_ ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;MPRINT(TEST): put "The test is Good!" ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;MPRINT(TEST): run ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;The test is Good!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;NOTE: DATA statement used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;real time 0.00 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;cpu time 0.00 seconds&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;33 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;34 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;35 %test&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;36 ( parameter = %nrstr( %if &amp;amp;variable. = 1 %then put "All Good!" ; )) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;MPRINT(TEST): data _null_ ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;NOTE: Line generated by the macro variable "PARAMETER".&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;36 %if &amp;amp;variable. = 1 %then put "All Good!" ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;_&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;2 The SAS System&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;180&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;MPRINT(TEST): %if &amp;amp;variable. = 1 %then put "All Good!" ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;MPRINT(TEST): put "The test is Good!" ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;MPRINT(TEST): run ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;NOTE: DATA statement used (Total process time):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;real time 0.00 seconds&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;cpu time 0.00 seconds&lt;/FONT&gt;&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;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kevin&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 17:08:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558701#M155944</guid>
      <dc:creator>KevinViel</dc:creator>
      <dc:date>2019-05-14T17:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: Macro statements as a macro parameter value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558703#M155946</link>
      <description>&lt;P&gt;Hey Kviel,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd say no.&amp;nbsp; The problem is that the macro statements need to be seen when the macro is compiled.&amp;nbsp; So if you try something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro foo
  (i=
  ,option =%nrstr( %if &amp;amp;i &amp;gt; 1 %then %put true; )
   );
  %unquote(&amp;amp;option)
%mend foo ;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%foo(i=2)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The %IF is not revealed until the macro foo is executing, so it's way too late for it to be used when foo is being compiled.&amp;nbsp; You get:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;8    %foo(i=2)
ERROR: The %IF statement is not valid in open code.
&lt;/PRE&gt;
&lt;P&gt;[update: I guess if you're on 9.4M5 or later you might get a different result, cuz open statement %IF is now allowed, but it still wouldn't be what you want.]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hard to see the big picture from what you've shared.&amp;nbsp; But I would stick with Master Ian's rule that nesting macro definitions is not a good idea.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;--Q.&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 17:17:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558703#M155946</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2019-05-14T17:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: Macro statements as a macro parameter value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558706#M155949</link>
      <description>&lt;P&gt;It's still not clear to me what you are trying to do, or why you need a macro command as the argument &amp;amp;parameter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nevertheless, this code seems to produce the desired output&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test(parameter = %str( )) ;
data _null_ ;
%if &amp;amp;parameter. ne %str( ) %then put "&amp;amp;parameter." %str(;);
%if &amp;amp;parameter. = 1 %then put "The test is Good!"%str(;);
run ;
%mend test ;

%test()

%test( parameter = 1)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PS: If you are going to paste a SAS log into your reply, please click on the {i} icon first and paste the log into the window that appears.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 17:24:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558706#M155949</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-05-14T17:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Macro statements as a macro parameter value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558708#M155951</link>
      <description>Even if you can get it to work, it sounds like there are better ways.  As it stands now, the burden on the user is incredibly high.  Why not use a simple parameter such as:&lt;BR /&gt;&lt;BR /&gt;,n_per_page=4,&lt;BR /&gt;&lt;BR /&gt;then put the burden on the programmer to make proper use of that parameter within the macro's logic.</description>
      <pubDate>Tue, 14 May 2019 17:31:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558708#M155951</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-05-14T17:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: Macro statements as a macro parameter value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558716#M155954</link>
      <description>&lt;P&gt;Don't even think of doing that for real.&lt;/P&gt;
&lt;P&gt;If you really need to you could have the macro generate a code file that defines macro and then execute the code file to define the macro.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro gen_macro(string);
filename code temp;
data _null_;
  file code ;
  put '%macro sub_macro;';
  length str $32767;
  str=dequote(symget('string'));
  put str;
  put '%mend sub_macro;';
run;
%include code;
%sub_macro;
%mend gen_macro;


%gen_macro('%if 1=1 %then %put found; %else %put not found; ');&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 May 2019 17:53:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558716#M155954</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-14T17:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Macro statements as a macro parameter value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558717#M155955</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36757"&gt;@KevinViel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;BR /&gt;I might not need the double %% signs, but it occurred to that the macro facility writes code, not macro.&amp;nbsp; This might be an example of when to nest a macro definition inside a macro, the elusive beast against which we were warned back in the heyday of SAS-L?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The logic doesn't follow. Just because you can't get this to work, does not imply that macros nested inside of macros are the solution.&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 17:55:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558717#M155955</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-05-14T17:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Macro statements as a macro parameter value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558718#M155956</link>
      <description>&lt;P&gt;Quentin,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Good to hear from you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I surmised the same, but you said it so much more fluently.&amp;nbsp; I was thinking of a macro writing a macro, but it failed.&amp;nbsp; I got further with data _null_ and call execute(), but not far enough.&amp;nbsp; At least I pushed my SAS knowledge today.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kevin&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 17:56:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/558718#M155956</guid>
      <dc:creator>KevinViel</dc:creator>
      <dc:date>2019-05-14T17:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Macro statements as a macro parameter value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/560873#M156924</link>
      <description>&lt;P&gt;The burden is high but so would be the flexibility.&amp;nbsp; I use such an approach "successfully" for allow the SAS (as opposed to the Macro) language to be the value of macro parameters.&amp;nbsp; For instance, I might have:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;amp;code.&lt;BR /&gt;output ;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and have macro parameter code have the value&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;code = if prxmatch( "/\.sas$/" , strip( pathfile )) then&lt;BR /&gt;&lt;BR /&gt;/* For example */&lt;BR /&gt;MLOGIC(XXXX): Parameter CODE has value if prxmatch( "/\.sas$/i" , strip( pathfile )) then&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It carries the same risk of allowing the programmers to program open SAS code, no?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kevin&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 15:06:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/560873#M156924</guid>
      <dc:creator>KevinViel</dc:creator>
      <dc:date>2019-05-22T15:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: Macro statements as a macro parameter value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/560879#M156926</link>
      <description>&lt;P&gt;Kevin,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would expect the failure rate to be far too high, in two regards:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;How many times does the user have to experiment to get it to work, and&lt;/LI&gt;
&lt;LI&gt;Even if it works, can there be confidence that the results are correct.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would try to mitigate the complications by using double resolution.&amp;nbsp; First, outside the macro have the user code something along these lines:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let mvar = if prxmatch( "/\.sas$/i" , strip( pathfile ));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The user has a better chance of getting the code right by removing the macro complications.&amp;nbsp; Next, when calling the macro, use the name of the macro variable only:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%call_to_macro (code=mvar)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Finally, inside the macro get the code to resolve using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;amp;&amp;amp;&amp;amp;code&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this is helpful.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 15:20:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-statements-as-a-macro-parameter-value/m-p/560879#M156926</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-05-22T15:20:45Z</dc:date>
    </item>
  </channel>
</rss>

