<?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 get a list of macro variables from an existing macro variable in Developers</title>
    <link>https://communities.sas.com/t5/Developers/How-to-get-a-list-of-macro-variables-from-an-existing-macro/m-p/3288#M1705</link>
    <description>Hi:&lt;BR /&gt;
  This is more of a macro usage question than a stored process question. Your best bet for a solution might be to contact Tech Support for help with a more automated approach or possibly using a multiple value parameter for your stored process.&lt;BR /&gt;
 &lt;BR /&gt;
  To "break down" the value in the old_list macro variable, you could use the SCAN function invoked with %SYSFUNC, as shown below:&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let old_list = a b c d ; &lt;BR /&gt;
  &lt;BR /&gt;
%let v1 = %sysfunc(scan(&amp;amp;old_list,1));&lt;BR /&gt;
%let v2 = %sysfunc(scan(&amp;amp;old_list,2));&lt;BR /&gt;
%let v3 = %sysfunc(scan(&amp;amp;old_list,3));&lt;BR /&gt;
%let v4 = %sysfunc(scan(&amp;amp;old_list,4));&lt;BR /&gt;
%let v5 = %sysfunc(scan(&amp;amp;old_list,5));&lt;BR /&gt;
   &lt;BR /&gt;
%put --------&amp;gt; pieces of old_list &amp;amp;old_list;&lt;BR /&gt;
%put --------&amp;gt; v1 = &amp;amp;v1;&lt;BR /&gt;
%put --------&amp;gt; v2 = &amp;amp;v2;&lt;BR /&gt;
%put --------&amp;gt; v3 = &amp;amp;v3;&lt;BR /&gt;
%put --------&amp;gt; v4 = &amp;amp;v4;&lt;BR /&gt;
%put --------&amp;gt; v5 = &amp;amp;v5;&lt;BR /&gt;
%put ----&amp;gt; Note how v5 is "null" when you have reached;&lt;BR /&gt;
%put ----&amp;gt; the end of the string contained in old_list;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
  &lt;BR /&gt;
To see how the SCAN function works, submit the above code from an EG code node or in a SAS Display Manager session. The results from the %PUT statements will appear in the SAS log. When you run this code snippet, you will see that I have created 5 separate macro variables -- &amp;amp;v1 thru &amp;amp;v4 have the values that were parsed out of &amp;amp;old_list and v5 is "null" because there was no 5th value in the string.&lt;BR /&gt;
 &lt;BR /&gt;
To really code a robust solution for your stored process so you can build multiple model statements, you will probably need a macro program and a macro %do loop (at the very least). Tech Support can help you with those. To contact Tech Support, refer to:&lt;BR /&gt;
 &lt;A href="http://support.sas.com/techsup/contact/index.html" target="_blank"&gt;http://support.sas.com/techsup/contact/index.html&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
Good luck,&lt;BR /&gt;
cynthia</description>
    <pubDate>Fri, 01 Jun 2007 15:56:34 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2007-06-01T15:56:34Z</dc:date>
    <item>
      <title>How to get a list of macro variables from an existing macro variable</title>
      <link>https://communities.sas.com/t5/Developers/How-to-get-a-list-of-macro-variables-from-an-existing-macro/m-p/3287#M1704</link>
      <description>I have a macro variable, which contains a list of character strings. I am wondering if there is any way to get a series of new macro variables from that. To illustrate with an example:&lt;BR /&gt;
&lt;BR /&gt;
I have: %let old_list = a b c d ; * a, b, c, d are the variable names in my model;&lt;BR /&gt;
I want following 3 new macro variables so that I can refit the model with new list:&lt;BR /&gt;
%let new_list1 = b c d;&lt;BR /&gt;
%let new_list2 = a c d;&lt;BR /&gt;
%let new_list3 = a b c;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I really appreciate any help on getting this. Thanks.</description>
      <pubDate>Thu, 31 May 2007 20:55:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-get-a-list-of-macro-variables-from-an-existing-macro/m-p/3287#M1704</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-05-31T20:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a list of macro variables from an existing macro variable</title>
      <link>https://communities.sas.com/t5/Developers/How-to-get-a-list-of-macro-variables-from-an-existing-macro/m-p/3288#M1705</link>
      <description>Hi:&lt;BR /&gt;
  This is more of a macro usage question than a stored process question. Your best bet for a solution might be to contact Tech Support for help with a more automated approach or possibly using a multiple value parameter for your stored process.&lt;BR /&gt;
 &lt;BR /&gt;
  To "break down" the value in the old_list macro variable, you could use the SCAN function invoked with %SYSFUNC, as shown below:&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let old_list = a b c d ; &lt;BR /&gt;
  &lt;BR /&gt;
%let v1 = %sysfunc(scan(&amp;amp;old_list,1));&lt;BR /&gt;
%let v2 = %sysfunc(scan(&amp;amp;old_list,2));&lt;BR /&gt;
%let v3 = %sysfunc(scan(&amp;amp;old_list,3));&lt;BR /&gt;
%let v4 = %sysfunc(scan(&amp;amp;old_list,4));&lt;BR /&gt;
%let v5 = %sysfunc(scan(&amp;amp;old_list,5));&lt;BR /&gt;
   &lt;BR /&gt;
%put --------&amp;gt; pieces of old_list &amp;amp;old_list;&lt;BR /&gt;
%put --------&amp;gt; v1 = &amp;amp;v1;&lt;BR /&gt;
%put --------&amp;gt; v2 = &amp;amp;v2;&lt;BR /&gt;
%put --------&amp;gt; v3 = &amp;amp;v3;&lt;BR /&gt;
%put --------&amp;gt; v4 = &amp;amp;v4;&lt;BR /&gt;
%put --------&amp;gt; v5 = &amp;amp;v5;&lt;BR /&gt;
%put ----&amp;gt; Note how v5 is "null" when you have reached;&lt;BR /&gt;
%put ----&amp;gt; the end of the string contained in old_list;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
  &lt;BR /&gt;
To see how the SCAN function works, submit the above code from an EG code node or in a SAS Display Manager session. The results from the %PUT statements will appear in the SAS log. When you run this code snippet, you will see that I have created 5 separate macro variables -- &amp;amp;v1 thru &amp;amp;v4 have the values that were parsed out of &amp;amp;old_list and v5 is "null" because there was no 5th value in the string.&lt;BR /&gt;
 &lt;BR /&gt;
To really code a robust solution for your stored process so you can build multiple model statements, you will probably need a macro program and a macro %do loop (at the very least). Tech Support can help you with those. To contact Tech Support, refer to:&lt;BR /&gt;
 &lt;A href="http://support.sas.com/techsup/contact/index.html" target="_blank"&gt;http://support.sas.com/techsup/contact/index.html&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
Good luck,&lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 01 Jun 2007 15:56:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-get-a-list-of-macro-variables-from-an-existing-macro/m-p/3288#M1705</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-06-01T15:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a list of macro variables from an existing macro variable</title>
      <link>https://communities.sas.com/t5/Developers/How-to-get-a-list-of-macro-variables-from-an-existing-macro/m-p/3289#M1706</link>
      <description>Thanks a lot Cynthia!</description>
      <pubDate>Fri, 01 Jun 2007 17:29:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-get-a-list-of-macro-variables-from-an-existing-macro/m-p/3289#M1706</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-06-01T17:29:24Z</dc:date>
    </item>
  </channel>
</rss>

