<?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: How to  a  keyword parameter macro in another macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-a-keyword-parameter-macro-in-another-macro/m-p/879615#M347505</link>
    <description>&lt;P&gt;Actually,&amp;nbsp; the macro that I am using takes two keyword parameters, but since I can't mention all the code, hence I am just giving a sample code after testing it that the error is coming for which I need help.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried as per your suggestion and it worked. Thank you very much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Jun 2023 17:16:57 GMT</pubDate>
    <dc:creator>Moksha</dc:creator>
    <dc:date>2023-06-07T17:16:57Z</dc:date>
    <item>
      <title>How to  a  keyword parameter macro in another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-a-keyword-parameter-macro-in-another-macro/m-p/879612#M347502</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I have a keyword parameter macro:&amp;nbsp; param2 takes a list of variables like var1, var2, var3, var4, var5, var6&lt;/P&gt;
&lt;PRE&gt;%macro test(param1=, param2=);
%let varlist=%sysfunc(translate(%sysfunc(upcase(&amp;amp;param2)),%str(,),%str( )));
%put &amp;amp;=varlist;
%mend test;&lt;/PRE&gt;
&lt;P&gt;The above macro is saved in a file test.sas&lt;/P&gt;
&lt;P&gt;Now, I want to include this macro in another macro and call it as shown:&lt;/P&gt;
&lt;PRE&gt;%macro test2(param1=,param2=);
#include "C:\Practice\test.sas";
%test(param1=,param2=);
%mend;&lt;/PRE&gt;
&lt;P&gt;But, it's not working.&amp;nbsp; Please, advise me how to call this macro?&lt;/P&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;103  %macro test2(param1=,param2=);
104  %include "C:\Practice\test.sas";
105  %test(param1=,param2=);
106  %mend;
107
108  %test2(param1=name, param2=var1 var2 var3 var4 var5 var6)
ERROR: The function UPCASE referenced by the %SYSFUNC or %QSYSFUNC macro function has too few
       arguments.
WARNING: Argument 1 to function TRANSLATE referenced by the %SYSFUNC or %QSYSFUNC macro
         function is out of range.
VARLIST=
&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Jun 2023 16:39:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-a-keyword-parameter-macro-in-another-macro/m-p/879612#M347502</guid>
      <dc:creator>Moksha</dc:creator>
      <dc:date>2023-06-07T16:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to  a  keyword parameter macro in another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-a-keyword-parameter-macro-in-another-macro/m-p/879613#M347503</link>
      <description>&lt;P&gt;Your example macros are confusing because they have parameters they don't use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I think your question is how to pass the INPUT to a macro into the call to another macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The answer is simple.&amp;nbsp; Just expand the parameter where you want to use it (the same thing you do to use the parameter for anything else).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test2(param1=,param2=);
%test(param1=&amp;amp;param1,param2=&amp;amp;param2);
%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you are confused because the two macros are using the same names for the parameters.&amp;nbsp; That does not matter in the context of running %TEST the reference to &amp;amp;PARAM1 is to the LOCAL macro variable that is created by defining PARAM1 as a parameter to the macro.&amp;nbsp; And in the context of %TEST2 the same thing applies.&amp;nbsp; &amp;amp;PARAM1 refers to the parameter named PARAM1 passed into the call to %TEST2.&amp;nbsp; When you have local macro variables with names that are the same as other macro variables that exist in outer scopes (including the GLOBAL scope) then the LOCAL macro variable hides the access to the others.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 17:09:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-a-keyword-parameter-macro-in-another-macro/m-p/879613#M347503</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-07T17:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to  a  keyword parameter macro in another macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-a-keyword-parameter-macro-in-another-macro/m-p/879615#M347505</link>
      <description>&lt;P&gt;Actually,&amp;nbsp; the macro that I am using takes two keyword parameters, but since I can't mention all the code, hence I am just giving a sample code after testing it that the error is coming for which I need help.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried as per your suggestion and it worked. Thank you very much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2023 17:16:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-a-keyword-parameter-macro-in-another-macro/m-p/879615#M347505</guid>
      <dc:creator>Moksha</dc:creator>
      <dc:date>2023-06-07T17:16:57Z</dc:date>
    </item>
  </channel>
</rss>

