<?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 - Variable number of arguments in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749846#M235734</link>
    <description>&lt;P&gt;I updated the code to use FINDW() to make it easier, try it now.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The concept is the same, pass the list of values in one parameter and write your macro to use the list. You can work out the details or what method works best for your situation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example you might just want to use the space delimited value in the generated code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%mymacro(varlist);
proc print data=sashelp.class;
  var &amp;amp;varlist;
run;
%mend;
%mymacro(name age sex)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or use a %DO loop;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%mymacro(dslist);
%local i dsn ;
%do i=1 %to %sysfunc(countw(&amp;amp;dslist,%str( )));
  %let dsn=%scan(&amp;amp;dslist,%str( ));
proc print data=&amp;amp;dsn;
run;
%mend;
%mymacro(sashelp.class sashelp.cars(obs=10))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or use some other delimiter besides space, like | or ^ that cannot appear in the actual values being passed.&amp;nbsp; I would avoid using comma as that will mean you need to use macro quoting to avoid SAS thinking you mean values for multiple parameters.&lt;/P&gt;</description>
    <pubDate>Wed, 23 Jun 2021 12:41:53 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-06-23T12:41:53Z</dc:date>
    <item>
      <title>Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749813#M235710</link>
      <description>&lt;P&gt;I would like to create a Macro that can take a variable number of arguments.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Please note that the psuedo-program that I write below perhaps could bypass the need for variable number of arguments, but the point with the programe is to demonstrate my need (In reality it is a more complex program that I am writing).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So the following program shows that I would like to create a function that can take arbitrary number of arguments and then sum them.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Macro MyMacro(X1, X2, + ...); 
   sum = X1 + X2 + ... ;
%mend; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If I knew that I would like to sum only two numbers, it would be very easy:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;%Macro MyMacro(X1, X2); 
   sum = X1 + X2;
%mend; &lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;But I don't know how many numbers I want to sum (it depends), so the question is, how could I allow for an arbitrary number of arguments?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 09:34:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749813#M235710</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2021-06-23T09:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749814#M235711</link>
      <description>Check out the Parmbuff Option&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://sasnrd.com/sas-parmbuff-macro-option/" target="_blank"&gt;https://sasnrd.com/sas-parmbuff-macro-option/&lt;/A&gt;</description>
      <pubDate>Wed, 23 Jun 2021 09:48:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749814#M235711</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-06-23T09:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749816#M235712</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/381436"&gt;@SasStatistics&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I would like to create a Macro that can take a variable number of arguments.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Please note that the psuedo-program that I write below perhaps could bypass the need for variable number of arguments, but the point with the programe is to demonstrate my need (In reality it is a more complex program that I am writing).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So the following program shows that I would like to create a function that can take arbitrary number of arguments and then sum them.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Macro MyMacro(X1, X2, + ...); 
   sum = X1 + X2 + ... ;
%mend; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If I knew that I would like to sum only two numbers, it would be very easy:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;%Macro MyMacro(X1, X2); 
   sum = X1 + X2;
%mend; &lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;But I don't know how many numbers I want to sum (it depends), so the question is, how could I allow for an arbitrary number of arguments?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This isn't a situation where you need a variable number of arguments. It is a situation where you need one argument that can have a different number of values each time you run the macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Macro MyMacro(X); 
   %let x=%sysfunc(translate(&amp;amp;x,%str(+),%str( )));
   sum = &amp;amp;x;
%mend; 

options mprint;
data want;
     %mymacro(2 4 6)
run;
data want2;
     %mymacro(2 4 6 8 10 12 14)
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or even more general solution&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Macro MyMacro(X); 
   %let x=%sysfunc(translate(&amp;amp;x,%str(+),%str( )));
   &amp;amp;x
%mend; 

options mprint;
data want;
     sum1=%mymacro(2 4 6);
     sum2=%mymacro(2 4 6 8 10 12 14);
run;&lt;/CODE&gt;&lt;/PRE&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 10:16:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749816#M235712</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-23T10:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749820#M235715</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;, what my actual function need is to be able to put in one argument with several table names (in retrospect, my pseudo program did not catch what I wanted i realize...).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So for instance argument x could look like:&amp;nbsp;&lt;BR /&gt;x = [Table1, Table2, Table3, ...].&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Something clever exists for this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 10:37:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749820#M235715</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2021-06-23T10:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749828#M235721</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/381436"&gt;@SasStatistics&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;, what my actual function need is to be able to put in one argument with several table names (in retrospect, my pseudo program did not catch what I wanted i realize...).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So for instance argument x could look like:&amp;nbsp;&lt;BR /&gt;x = [Table1, Table2, Table3, ...].&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Something clever exists for this?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What are you going to do with the several table names??&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Again, I don't think you need several macro arguments, I think you need one argument that can contain several table names ... but until I know what you intend to do with the table names, I can't be sure.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 11:30:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749828#M235721</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-23T11:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749837#M235726</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;&amp;nbsp;I think you need one argument that can contain several table names&lt;/SPAN&gt;", exactly what I mean (and think I wrote in the reply?). &lt;BR /&gt;&lt;BR /&gt;The function I would like to create will from each table name extract all the columns in the table and print it out so the user can get an overview. &lt;BR /&gt;&lt;BR /&gt;Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt; .&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 12:07:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749837#M235726</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2021-06-23T12:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749839#M235728</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/381436"&gt;@SasStatistics&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;BR /&gt;The function I would like to create will from each table name extract all the columns in the table.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Extract all the columns? Or extract all the column names?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming you mean column names, here is some code that also uses the %qlist macro (at&amp;nbsp;&lt;A href="https://github.com/sasutils/macros/blob/master/qlist.sas" target="_blank" rel="noopener"&gt;https://github.com/sasutils/macros/blob/master/qlist.sas&lt;/A&gt;).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro colnames(arg);
    %let q_arg=%qlist(&amp;amp;arg);
    proc sql;
        create table colnames as select libname,memname,name
        from dictionary.columns where upcase(memname) in %upcase(&amp;amp;q_arg);
    quit;
%mend;

%colnames(cars want)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'm sure there are ways to do this without %qlist, but I'm so used to using %qlist that I don't ever bother to try to figure out other ways to do it without %qlist.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 12:19:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749839#M235728</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-23T12:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749840#M235729</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/381436"&gt;@SasStatistics&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;"&lt;SPAN&gt;&amp;nbsp;I think you need one argument that can contain several table names&lt;/SPAN&gt;", exactly what I mean (and think I wrote in the reply?). &lt;BR /&gt;&lt;BR /&gt;The function I would like to create will from each table name extract all the columns in the table and print it out so the user can get an overview. &lt;BR /&gt;&lt;BR /&gt;Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt; .&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Supply the list of names as the value of one parameter.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro mymacro(members);
proc print data=sashelp.vcolumn;
  where findw("&amp;amp;members",memname,' ','it');
  var libname memname varnum name type length format label;
run;
%mend mymacro;
%mymacro(class&amp;nbsp;cars)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Jun 2021 12:30:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749840#M235729</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-23T12:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749843#M235732</link>
      <description>Trying to run this code I don't get anything? &lt;BR /&gt;&lt;BR /&gt;The purpose is to use one argument with multiple table names and then extract the column names from each table. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Jun 2021 12:31:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749843#M235732</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2021-06-23T12:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749845#M235733</link>
      <description>&lt;P&gt;I wanted to extract all column names.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Running the code supplied:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro colnames(arg);
    %let q_arg=%qlist(&amp;amp;arg);
    proc sql;
        create table colnames as select libname,memname,name
        from dictionary.columns where upcase(memname) in %upcase(&amp;amp;q_arg);
    quit;
%mend;

%colnames(cars want)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;yields the following error:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;WARNING: Apparent invocation of macro QLIST not resolved.


WARNING: Apparent invocation of macro QLIST not resolved.
NOTE: Line generated by the macro function "UPCASE".
36          %QLIST(CARS WANT)
            _
            22
            76
WARNING: Apparent invocation of macro QLIST not resolved.
ERROR 22-322: Syntax error, expecting one of the following: (, SELECT.  

ERROR 76-322: Syntax error, statement will be ignored.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 12:35:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749845#M235733</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2021-06-23T12:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749846#M235734</link>
      <description>&lt;P&gt;I updated the code to use FINDW() to make it easier, try it now.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The concept is the same, pass the list of values in one parameter and write your macro to use the list. You can work out the details or what method works best for your situation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example you might just want to use the space delimited value in the generated code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%mymacro(varlist);
proc print data=sashelp.class;
  var &amp;amp;varlist;
run;
%mend;
%mymacro(name age sex)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or use a %DO loop;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%mymacro(dslist);
%local i dsn ;
%do i=1 %to %sysfunc(countw(&amp;amp;dslist,%str( )));
  %let dsn=%scan(&amp;amp;dslist,%str( ));
proc print data=&amp;amp;dsn;
run;
%mend;
%mymacro(sashelp.class sashelp.cars(obs=10))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or use some other delimiter besides space, like | or ^ that cannot appear in the actual values being passed.&amp;nbsp; I would avoid using comma as that will mean you need to use macro quoting to avoid SAS thinking you mean values for multiple parameters.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 12:41:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749846#M235734</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-23T12:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749847#M235735</link>
      <description>&lt;P&gt;You need to define macros before using them (or at least same them in your autocall library so SAS can find them to autocompile).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a QLIST macro that would probably work with the program.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/sasutils/macros/blob/master/qlist.sas" target="_blank"&gt;https://github.com/sasutils/macros/blob/master/qlist.sas&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 12:39:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749847#M235735</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-23T12:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749848#M235736</link>
      <description>&lt;P&gt;You have to place the code for %qlist in your code before %colnames, and then execute both. I put %qlist (and many other useful macros) in my &lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/mcrolref/p12b2qq72dkxpsn1e19y57emerr6.htm" target="_self"&gt;AUTOCALL library&lt;/A&gt;, so I don't need to copy and paste the code for the %qlist macro every time I want to use it. The AUTOCALL library is in my AUTOEXEC so every time I launch SAS, these macros are made available to me. If you are going to be writing a lot of macros, you should set up an AUTOCALL library. Here is the command in my AUTOEXEC file and all of my utility macros are stored in that folder..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options sasautos=(sasautos 'myserver\MillerP\Macros');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 12:50:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749848#M235736</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-23T12:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749849#M235737</link>
      <description>If the function I am using will be used by other people, what would be best then? To include the code for the %qlist macro in my macro? &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Jun 2021 12:51:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749849#M235737</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2021-06-23T12:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749853#M235738</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/381436"&gt;@SasStatistics&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;If the function I am using will be used by other people, what would be best then? To include the code for the %qlist macro in my macro? &lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The answer is a great big "it depends" and also, as I'm sure you know, there are "many ways to skin a cat" as the expression goes (although I can't verify that the expression is true as I have never tried doing that).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Certainly, you can place %qlist in the same file as %mymacro and named mymacro.sas (again, better names are needed) and then distribute this SAS file to whomever you'd like (or use the code from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;which doesn't require %qlist).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If everyone can access your server where mymacro.sas is stored and where qlist.sas is stored as separate files, then they can add this as the first line of their code and then suddenly, like magic, they can access both qlist.sas and mymacro.sas and any other macro in the indicated folder, and now %qlist does not have to be defined inside mymacro.sas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options append=(sasautos="myserver\MillerP\Macros");
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The benefit of doing it this way on a server that everyone can access is that if you fix a bug or add a new feature to your macro, everyone using it this way gets the&amp;nbsp; changes instantaneously, with zero effort on their part. If you have to include %qlist in the file and then perhaps e-mail it to others, then when you update your copy, the recipients of the e-mail still have the old version.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is also a way to call the qlist.sas file directly from github in your program and so you just need one command in your code to access %qlist. Not everyone can do this, there are some restrictions on what external files I can access from my company computer becuase of the company firewall; and so I don't know the command, but I'm sure others do. Again, it depends on if this will work behind your company's firewall.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 13:19:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749853#M235738</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-23T13:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749862#M235740</link>
      <description>&lt;P&gt;Haha I am sure there is although I have not tried it either... &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"If everyone can access your server where mymacro.sas is stored and where qlist.sas is stored as separate files, &lt;STRONG&gt;then they can add this as the first line of their&lt;/STRONG&gt; code and then suddenly, like magic, they can access both qlist.sas and mymacro.sas and any other macro in the indicated folder, and now %qlist does not have to be defined inside mymacro.sas"&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;This is the alternative I will go for. What do you mean by: &lt;EM&gt;"&lt;STRONG&gt;then they can add this as the first line of their"?&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 13:28:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749862#M235740</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2021-06-23T13:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Variable number of arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749866#M235742</link>
      <description>&lt;P&gt;The first line of the program they write to use your macros should be the OPTIONS statement I provided.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 13:32:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-number-of-arguments/m-p/749866#M235742</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-23T13:32:52Z</dc:date>
    </item>
  </channel>
</rss>

