<?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: add 2 macro variables coming from SAS EG prompts in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/add-2-macro-variables-coming-from-SAS-EG-prompts/m-p/447849#M112577</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your problem is independant of Eg prompts.&lt;/P&gt;
&lt;P&gt;When a macrovariable is created as follows :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let mv1=1; %let mv2=2;&lt;/P&gt;
&lt;P&gt;%let mv=&amp;amp;mv1.+&amp;amp;mv2.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The compiler only performs text substitution so you wil end up with &amp;amp;mv.=1+2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to evaluate the resulting expression you have to enclose the whole&lt;/P&gt;
&lt;P&gt;expression in an evaluation function %eval() or %sysevalf&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let mv=%eval(&amp;amp;mv1.+&amp;amp;mv2.); /* =&amp;gt; 3 */&lt;/P&gt;</description>
    <pubDate>Thu, 22 Mar 2018 16:52:17 GMT</pubDate>
    <dc:creator>gamotte</dc:creator>
    <dc:date>2018-03-22T16:52:17Z</dc:date>
    <item>
      <title>add 2 macro variables coming from SAS EG prompts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-2-macro-variables-coming-from-SAS-EG-prompts/m-p/447843#M112575</link>
      <description>&lt;P&gt;This is a very simple one. I try to add 2 macro variables, which are initialized from SAS EG prompts (Number1 and Number2). I currently use this code it should work for non integer number):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Result = %sysevalf(&amp;amp;Number1.,integer) + %sysevalf(&amp;amp;Number2.,integer); 

%put &amp;amp;Result.;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Unfortunately, only the expression rather than the result is printed.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 16:27:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-2-macro-variables-coming-from-SAS-EG-prompts/m-p/447843#M112575</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2018-03-22T16:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: add 2 macro variables coming from SAS EG prompts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-2-macro-variables-coming-from-SAS-EG-prompts/m-p/447849#M112577</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your problem is independant of Eg prompts.&lt;/P&gt;
&lt;P&gt;When a macrovariable is created as follows :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let mv1=1; %let mv2=2;&lt;/P&gt;
&lt;P&gt;%let mv=&amp;amp;mv1.+&amp;amp;mv2.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The compiler only performs text substitution so you wil end up with &amp;amp;mv.=1+2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to evaluate the resulting expression you have to enclose the whole&lt;/P&gt;
&lt;P&gt;expression in an evaluation function %eval() or %sysevalf&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let mv=%eval(&amp;amp;mv1.+&amp;amp;mv2.); /* =&amp;gt; 3 */&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 16:52:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-2-macro-variables-coming-from-SAS-EG-prompts/m-p/447849#M112577</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-03-22T16:52:17Z</dc:date>
    </item>
  </channel>
</rss>

