<?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 flexible macro names in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/flexible-macro-names/m-p/75633#M7529</link>
    <description>Hi&lt;BR /&gt;
I am wanting to assign different macro variables to an array.  With help from this forum, I have the assignment of the macro variable working in principle.  However, I would like to change which macro variables are assigned to this array (i.e. "&amp;amp;adjust0904 &amp;amp;adjust0906" in the sample code below).  I cannot figure out the code to get this working.  Any ideas?  Thanks!&lt;BR /&gt;
&lt;BR /&gt;
%Macro Survey(Months);&lt;BR /&gt;
&lt;BR /&gt;
%Let adjust0904 = 1.1;&lt;BR /&gt;
%Let adjust0905 = 1.2;&lt;BR /&gt;
%Let adjust0906 = 1.3;&lt;BR /&gt;
&lt;BR /&gt;
Data B;&lt;BR /&gt;
Set survey;&lt;BR /&gt;
&lt;BR /&gt;
* &amp;amp;Months should be incorporated some how to provide the code below: ; &lt;BR /&gt;
array aj{2} _temporary_ (&amp;amp;adjust0904 &amp;amp;adjust0906);&lt;BR /&gt;
&lt;BR /&gt;
Do i = 1 to 2;&lt;BR /&gt;
...code...&lt;BR /&gt;
End;&lt;BR /&gt;
Run;&lt;BR /&gt;
%Mend;&lt;BR /&gt;
%Survey (0904 0905);</description>
    <pubDate>Wed, 14 Oct 2009 13:45:08 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-10-14T13:45:08Z</dc:date>
    <item>
      <title>flexible macro names</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/flexible-macro-names/m-p/75633#M7529</link>
      <description>Hi&lt;BR /&gt;
I am wanting to assign different macro variables to an array.  With help from this forum, I have the assignment of the macro variable working in principle.  However, I would like to change which macro variables are assigned to this array (i.e. "&amp;amp;adjust0904 &amp;amp;adjust0906" in the sample code below).  I cannot figure out the code to get this working.  Any ideas?  Thanks!&lt;BR /&gt;
&lt;BR /&gt;
%Macro Survey(Months);&lt;BR /&gt;
&lt;BR /&gt;
%Let adjust0904 = 1.1;&lt;BR /&gt;
%Let adjust0905 = 1.2;&lt;BR /&gt;
%Let adjust0906 = 1.3;&lt;BR /&gt;
&lt;BR /&gt;
Data B;&lt;BR /&gt;
Set survey;&lt;BR /&gt;
&lt;BR /&gt;
* &amp;amp;Months should be incorporated some how to provide the code below: ; &lt;BR /&gt;
array aj{2} _temporary_ (&amp;amp;adjust0904 &amp;amp;adjust0906);&lt;BR /&gt;
&lt;BR /&gt;
Do i = 1 to 2;&lt;BR /&gt;
...code...&lt;BR /&gt;
End;&lt;BR /&gt;
Run;&lt;BR /&gt;
%Mend;&lt;BR /&gt;
%Survey (0904 0905);</description>
      <pubDate>Wed, 14 Oct 2009 13:45:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/flexible-macro-names/m-p/75633#M7529</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-14T13:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: flexible macro names</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/flexible-macro-names/m-p/75634#M7530</link>
      <description>Hi:&lt;BR /&gt;
  You will want to read about referencing macro variables "indirectly", as explained in this documentation topic:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a001071915.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a001071915.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
  Basically, the way you reference macro variables indirectly is to allow a "final" string to be resolved from multiple macro variable references. Consider the macro program at the bottom of this posting for an example of indirect macro references.&lt;BR /&gt;
 &lt;BR /&gt;
  These papers may also be useful to you:&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi29/128-29.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi29/128-29.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi22/CODERS/PAPER77.PDF" target="_blank"&gt;http://www2.sas.com/proceedings/sugi22/CODERS/PAPER77.PDF&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www.lexjansen.com/sugi/sugi21/bt/054-21.pdf" target="_blank"&gt;http://www.lexjansen.com/sugi/sugi21/bt/054-21.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www.ats.ucla.edu/stat/sas/library/nesug98/p086.pdf" target="_blank"&gt;http://www.ats.ucla.edu/stat/sas/library/nesug98/p086.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www.nesug.org/Proceedings/nesug97/posters/gerlach.pdf" target="_blank"&gt;http://www.nesug.org/Proceedings/nesug97/posters/gerlach.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://studysas.blogspot.com/2009/02/3when-to-use-do-we-distinguishmultiple.html" target="_blank"&gt;http://studysas.blogspot.com/2009/02/3when-to-use-do-we-distinguishmultiple.html&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
   &lt;BR /&gt;
[pre]&lt;BR /&gt;
%let fav = muppet;&lt;BR /&gt;
%let muppet1 = kermit;&lt;BR /&gt;
%let muppet2 = elmo;&lt;BR /&gt;
%let muppet3 = big bird;&lt;BR /&gt;
               &lt;BR /&gt;
%macro listmup2;&lt;BR /&gt;
  %do i = 1 %to 3;&lt;BR /&gt;
     %put My favorite &amp;amp;fav number &amp;amp;i is: &amp;amp;&amp;amp;muppet&amp;amp;i;&lt;BR /&gt;
	 %put Alternate: My favorite &amp;amp;fav is: &amp;amp;&amp;amp;&amp;amp;fav&amp;amp;i;&lt;BR /&gt;
  %end;&lt;BR /&gt;
%mend listmup2;&lt;BR /&gt;
                     &lt;BR /&gt;
%listmup2;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 14 Oct 2009 15:20:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/flexible-macro-names/m-p/75634#M7530</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-10-14T15:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: flexible macro names</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/flexible-macro-names/m-p/75635#M7531</link>
      <description>You can parse the incoming parameter then append it to the root of your macro variable.&lt;BR /&gt;
&lt;BR /&gt;
%macro survey( parm);&lt;BR /&gt;
&lt;BR /&gt;
%Let adjust0904 = 1.1;&lt;BR /&gt;
%Let adjust0905 = 1.2;&lt;BR /&gt;
%Let adjust0906 = 1.3;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%let i = 1;&lt;BR /&gt;
%do %while (%scan(&amp;amp;parm, &amp;amp;i, ' ') ^= );&lt;BR /&gt;
  %let cd = %scan(&amp;amp;parm, &amp;amp;i, ' ');&lt;BR /&gt;
  %put &amp;amp;&amp;amp;adjust&amp;amp;cd;&lt;BR /&gt;
%let i = %eval(&amp;amp;i + 1);&lt;BR /&gt;
%end;&lt;BR /&gt;
%mend;&lt;BR /&gt;
%survey(0904 0906);</description>
      <pubDate>Wed, 14 Oct 2009 15:33:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/flexible-macro-names/m-p/75635#M7531</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-10-14T15:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: flexible macro names</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/flexible-macro-names/m-p/75636#M7532</link>
      <description>This is fantastic - thanks to you both!!  The following code in the data step does the trick:&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let adjust = ;&lt;BR /&gt;
&lt;BR /&gt;
%let i = 1;&lt;BR /&gt;
%do %while (%scan(&amp;amp;parm, &amp;amp;i, ' ') ^= );&lt;BR /&gt;
  %let cd = %scan(&amp;amp;parm, &amp;amp;i, ' ');&lt;BR /&gt;
  %let adjust = &amp;amp;adjust &amp;amp;&amp;amp;adjust&amp;amp;cd;&lt;BR /&gt;
  %put &amp;amp;adjust;&lt;BR /&gt;
%let i = %eval(&amp;amp;i + 1);&lt;BR /&gt;
&lt;BR /&gt;
%end;&lt;BR /&gt;
&lt;BR /&gt;
array aj{3} _temporary_ (&amp;amp;adjust);&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 15 Oct 2009 10:19:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/flexible-macro-names/m-p/75636#M7532</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-15T10:19:56Z</dc:date>
    </item>
  </channel>
</rss>

