<?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: multiplication in sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/multiplication-in-sas/m-p/696096#M212544</link>
    <description>&lt;P&gt;You need to read about numeric precision. Lots of resources on the web and here.&lt;/P&gt;
&lt;P&gt;Summary: the binary system used by computers is perfect for storing powers-of-2 numbers, not so good for storing decimals.&lt;/P&gt;
&lt;P&gt;Run this to see the horrid details:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  A=1.5*1.2-1.8;   
  putlog A= 32.16;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;A=-0.0000000000000002&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Nov 2020 05:40:55 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2020-11-03T05:40:55Z</dc:date>
    <item>
      <title>multiplication in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiplication-in-sas/m-p/696090#M212538</link>
      <description>&lt;P&gt;Hi, all&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;Am having the following code, could someone kindly explain to me why the values of d1 and d2 are missing. Though we have the value of c=1.8.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mult;
  a=1.2;b=1.5;
  c=a*b;
  if c="1.8" then d1=1;
   if c=1.8 then d2=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2020 05:06:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiplication-in-sas/m-p/696090#M212538</guid>
      <dc:creator>himself</dc:creator>
      <dc:date>2020-11-03T05:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: multiplication in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiplication-in-sas/m-p/696096#M212544</link>
      <description>&lt;P&gt;You need to read about numeric precision. Lots of resources on the web and here.&lt;/P&gt;
&lt;P&gt;Summary: the binary system used by computers is perfect for storing powers-of-2 numbers, not so good for storing decimals.&lt;/P&gt;
&lt;P&gt;Run this to see the horrid details:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  A=1.5*1.2-1.8;   
  putlog A= 32.16;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;A=-0.0000000000000002&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2020 05:40:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiplication-in-sas/m-p/696096#M212544</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-11-03T05:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: multiplication in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiplication-in-sas/m-p/696114#M212558</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310015"&gt;@himself&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;round()&lt;/FONT&gt; function can be useful in situations like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is documented&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=vdmmlcdc&amp;amp;cdcVersion=8.1&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p0tj6cmga7p8qln1ejh6ebevm0c9.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&amp;nbsp;and has a discussion and demonstration of the type&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;was referring to.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2020 07:51:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiplication-in-sas/m-p/696114#M212558</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2020-11-03T07:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: multiplication in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiplication-in-sas/m-p/696116#M212560</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Column c is numeric, why do you compare it to a string ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To compare floating points numbers, you can do as follows :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let precision=1.0e-06;

data mult;
  a=1.2;b=1.5;
  c=a*b;
   if abs(sum(c,-1.8))&amp;lt;&amp;amp;precision. then d2=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Nov 2020 08:08:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiplication-in-sas/m-p/696116#M212560</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2020-11-03T08:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: multiplication in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiplication-in-sas/m-p/696132#M212568</link>
      <description>Hi, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;, thanks for sharing , actually I thought SaS performs the multiplication of decimals as the normal way one can do multiplication, plus the way it stores the values, I have  realized its very different</description>
      <pubDate>Tue, 03 Nov 2020 09:47:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiplication-in-sas/m-p/696132#M212568</guid>
      <dc:creator>himself</dc:creator>
      <dc:date>2020-11-03T09:47:13Z</dc:date>
    </item>
  </channel>
</rss>

