<?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 Dynamic macrovariable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-macrovariable/m-p/353772#M82601</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have several macrovariable named:&lt;/P&gt;&lt;PRE&gt;&amp;amp;mAA
&amp;amp;mAB
&amp;amp;mBA
&amp;amp;mBB&lt;BR /&gt;...&lt;/PRE&gt;&lt;P&gt;Each of them has a string value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I create a macro with two arguments&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;mymacro ( firststring, secondstring)&lt;/PRE&gt;&lt;P&gt;I want this macro to be able to modify the current value of one of my macrovariable with the value of secondstring.&lt;/P&gt;&lt;P&gt;Which macrovariable need to be modified? That's the point:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The value of the firststring can be "AA","AB","BA,"BB",...&lt;/P&gt;&lt;P&gt;If it is AA I need to modify &amp;amp;mAA&lt;/P&gt;&lt;P&gt;If it is BA I need to modify &amp;amp;mBA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Globally I need to do&lt;/P&gt;&lt;PRE&gt;&amp;amp;m&amp;amp;firststring.. = &amp;amp;secondstring.;&lt;/PRE&gt;&lt;P&gt;But like this of course, it is not working, and I don't really know how to do it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have an idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Apr 2017 16:03:07 GMT</pubDate>
    <dc:creator>Planck</dc:creator>
    <dc:date>2017-04-26T16:03:07Z</dc:date>
    <item>
      <title>Dynamic macrovariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-macrovariable/m-p/353772#M82601</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have several macrovariable named:&lt;/P&gt;&lt;PRE&gt;&amp;amp;mAA
&amp;amp;mAB
&amp;amp;mBA
&amp;amp;mBB&lt;BR /&gt;...&lt;/PRE&gt;&lt;P&gt;Each of them has a string value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I create a macro with two arguments&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;mymacro ( firststring, secondstring)&lt;/PRE&gt;&lt;P&gt;I want this macro to be able to modify the current value of one of my macrovariable with the value of secondstring.&lt;/P&gt;&lt;P&gt;Which macrovariable need to be modified? That's the point:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The value of the firststring can be "AA","AB","BA,"BB",...&lt;/P&gt;&lt;P&gt;If it is AA I need to modify &amp;amp;mAA&lt;/P&gt;&lt;P&gt;If it is BA I need to modify &amp;amp;mBA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Globally I need to do&lt;/P&gt;&lt;PRE&gt;&amp;amp;m&amp;amp;firststring.. = &amp;amp;secondstring.;&lt;/PRE&gt;&lt;P&gt;But like this of course, it is not working, and I don't really know how to do it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have an idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 16:03:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-macrovariable/m-p/353772#M82601</guid>
      <dc:creator>Planck</dc:creator>
      <dc:date>2017-04-26T16:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic macrovariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-macrovariable/m-p/353774#M82603</link>
      <description>&lt;P&gt;You'll need to construct a %LET statement to assign a value to a macro variable.&amp;nbsp; The contents of your macro might end up looking like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let m&amp;amp;firststring = &amp;amp;&amp;amp;m&amp;amp;secondstring;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or, it might end up being:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let m&amp;amp;firststring = &amp;amp;secondstring;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's not clear which result you are looking for (probably the second one, based on your sample attempted code), but both of these are somewhere in the ballpark.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 16:11:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-macrovariable/m-p/353774#M82603</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-04-26T16:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic macrovariable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-macrovariable/m-p/353783#M82608</link>
      <description>&lt;P&gt;It's indeed the second one. Sorry if I was not completely clear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks very much for the answer! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 16:25:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-macrovariable/m-p/353783#M82608</guid>
      <dc:creator>Planck</dc:creator>
      <dc:date>2017-04-26T16:25:48Z</dc:date>
    </item>
  </channel>
</rss>

