<?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: Trouble with arithmetic operators in Macros in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Trouble-with-arithmetic-operators-in-Macros/m-p/35979#M8971</link>
    <description>Cynthia,&lt;BR /&gt;
&lt;BR /&gt;
Wow, thanks for the information.  That was perfect!  Am I correct in assuming that there is no way to do a SQRT?  I didn't see it on the list of operators from:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/z6express.htm#a001072320" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/z6express.htm#a001072320&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
MBI</description>
    <pubDate>Mon, 25 May 2009 12:08:35 GMT</pubDate>
    <dc:creator>MBI</dc:creator>
    <dc:date>2009-05-25T12:08:35Z</dc:date>
    <item>
      <title>Trouble with arithmetic operators in Macros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trouble-with-arithmetic-operators-in-Macros/m-p/35977#M8969</link>
      <description>Hi all,&lt;BR /&gt;
&lt;BR /&gt;
I'm pretty new to macros and I ran into a roadblock on the code below.  I don't understand why the first one works but the second one doesn't.  Any help would be appreciated!&lt;BR /&gt;
&lt;BR /&gt;
-MBI&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Example 1 - the 'do' loop is executed&lt;BR /&gt;
%let A = 1;&lt;BR /&gt;
%let B = 2;&lt;BR /&gt;
%let P = (&amp;amp;A + &amp;amp;B);&lt;BR /&gt;
	%if &amp;amp;P = 3 %then %do;&lt;BR /&gt;
		proc sql;&lt;BR /&gt;
			UPDATE nxn SET M1=333 WHERE obs=1;&lt;BR /&gt;
		run;&lt;BR /&gt;
	%end;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Example 2 - the 'do' loop is NOT executed&lt;BR /&gt;
%let A = 1;&lt;BR /&gt;
%let B = 2;&lt;BR /&gt;
%let P = (&amp;amp;A / &amp;amp;B);&lt;BR /&gt;
	%if &amp;amp;P = 0.5 %then %do;&lt;BR /&gt;
		proc sql;&lt;BR /&gt;
			UPDATE nxn SET M1=333 WHERE obs=1;&lt;BR /&gt;
		run;&lt;BR /&gt;
	%end;&lt;BR /&gt;
&lt;BR /&gt;
I'm also having the same problem with the do loop not executing when using the SQRT operator.  Everything seems to work fine if I stay away from division and SQRT.  Any ideas?</description>
      <pubDate>Mon, 25 May 2009 00:35:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trouble-with-arithmetic-operators-in-Macros/m-p/35977#M8969</guid>
      <dc:creator>MBI</dc:creator>
      <dc:date>2009-05-25T00:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with arithmetic operators in Macros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trouble-with-arithmetic-operators-in-Macros/m-p/35978#M8970</link>
      <description>Hi:&lt;BR /&gt;
  I suggest you read the Macro doc on how arithmetic needs to be specified in order to be evaluated correctly:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a001072288.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a001072288.htm&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/z6express.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/z6express.htm&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Mon, 25 May 2009 00:43:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trouble-with-arithmetic-operators-in-Macros/m-p/35978#M8970</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-05-25T00:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with arithmetic operators in Macros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trouble-with-arithmetic-operators-in-Macros/m-p/35979#M8971</link>
      <description>Cynthia,&lt;BR /&gt;
&lt;BR /&gt;
Wow, thanks for the information.  That was perfect!  Am I correct in assuming that there is no way to do a SQRT?  I didn't see it on the list of operators from:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/z6express.htm#a001072320" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/z6express.htm#a001072320&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
MBI</description>
      <pubDate>Mon, 25 May 2009 12:08:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trouble-with-arithmetic-operators-in-Macros/m-p/35979#M8971</guid>
      <dc:creator>MBI</dc:creator>
      <dc:date>2009-05-25T12:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with arithmetic operators in Macros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trouble-with-arithmetic-operators-in-Macros/m-p/35980#M8972</link>
      <description>You have DATA step functions available in macro language when using the %SYSFUNC macro function.  Here is a DOC link - also search the SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website for additional technical references on the topic.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a001962663.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a001962663.htm&lt;/A&gt;</description>
      <pubDate>Mon, 25 May 2009 12:46:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trouble-with-arithmetic-operators-in-Macros/m-p/35980#M8972</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-05-25T12:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with arithmetic operators in Macros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trouble-with-arithmetic-operators-in-Macros/m-p/35981#M8973</link>
      <description>you may find %sysEvalF() helpful, for example [pre]       %put sqrt = %sysevalF( 64 ** 0.5 ) ;&lt;BR /&gt;
       %put sqrt = %sysevalF( 60 ** 0.5 ) ;[/pre] &lt;BR /&gt;
 &lt;BR /&gt;
These print square roots in the log, like[pre]1     %put sqrt = %sysevalF( 64 ** 0.5 ) ;&lt;BR /&gt;
sqrt = 8&lt;BR /&gt;
2     %put sqrt = %sysevalF( 60 ** 0.5 ) ;&lt;BR /&gt;
sqrt = 7.74596669241483[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
PeterC</description>
      <pubDate>Tue, 26 May 2009 11:53:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trouble-with-arithmetic-operators-in-Macros/m-p/35981#M8973</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-05-26T11:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with arithmetic operators in Macros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trouble-with-arithmetic-operators-in-Macros/m-p/35982#M8974</link>
      <description>Cynthia/Scott/Peter,&lt;BR /&gt;
&lt;BR /&gt;
Thanks so much for the help.  My macro is now working properly.&lt;BR /&gt;
&lt;BR /&gt;
-MBI</description>
      <pubDate>Tue, 26 May 2009 20:15:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trouble-with-arithmetic-operators-in-Macros/m-p/35982#M8974</guid>
      <dc:creator>MBI</dc:creator>
      <dc:date>2009-05-26T20:15:28Z</dc:date>
    </item>
  </channel>
</rss>

