<?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: Evaluating a macro variable string that contains variable names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Evaluating-a-macro-variable-string-that-contains-variable-names/m-p/338185#M76941</link>
    <description>&lt;P&gt;Remove quotes from the %let statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replace ??? In datastep with &amp;amp;c.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At its basics consider macro variables as a Find/Replace algorithm. The result needs to be valid SAS code.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 04 Mar 2017 23:00:55 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-03-04T23:00:55Z</dc:date>
    <item>
      <title>Evaluating a macro variable string that contains variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluating-a-macro-variable-string-that-contains-variable-names/m-p/338174#M76932</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would be very grateful if someone could please help me with the following query.&amp;nbsp; I have a macro variable that contains a string, but the expression contains variable names.&amp;nbsp; In the example below, the macro variable contains an expression that refers to variables 'a' and 'b'.&amp;nbsp; The dataset 'testdata' contains these variables.&amp;nbsp; I would like to know how to set 'c' to be the numeric result of evaluating the macro variable 'test', so should equal 3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%Let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test = "a+b";&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; testdata;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;&amp;nbsp; a=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;&amp;nbsp; b=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c=???;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Many thanks,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Hoa&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Mar 2017 22:21:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluating-a-macro-variable-string-that-contains-variable-names/m-p/338174#M76932</guid>
      <dc:creator>HoaTruong</dc:creator>
      <dc:date>2017-03-04T22:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluating a macro variable string that contains variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluating-a-macro-variable-string-that-contains-variable-names/m-p/338185#M76941</link>
      <description>&lt;P&gt;Remove quotes from the %let statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replace ??? In datastep with &amp;amp;c.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At its basics consider macro variables as a Find/Replace algorithm. The result needs to be valid SAS code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Mar 2017 23:00:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluating-a-macro-variable-string-that-contains-variable-names/m-p/338185#M76941</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-03-04T23:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluating a macro variable string that contains variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluating-a-macro-variable-string-that-contains-variable-names/m-p/338202#M76949</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Let test = a+b;

Data testdata;
	a=1;
	b=2;
	c=&amp;amp;test.;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 05 Mar 2017 02:26:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluating-a-macro-variable-string-that-contains-variable-names/m-p/338202#M76949</guid>
      <dc:creator>avinashns</dc:creator>
      <dc:date>2017-03-05T02:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluating a macro variable string that contains variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluating-a-macro-variable-string-that-contains-variable-names/m-p/338259#M76983</link>
      <description>Thank you very much! I forgot I had the quotes in the macro expression - too much staring at code..! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;</description>
      <pubDate>Sun, 05 Mar 2017 17:58:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluating-a-macro-variable-string-that-contains-variable-names/m-p/338259#M76983</guid>
      <dc:creator>HoaTruong</dc:creator>
      <dc:date>2017-03-05T17:58:20Z</dc:date>
    </item>
  </channel>
</rss>

