<?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: how to deal very small or large numbers when doing computation using SAS? in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/how-to-deal-very-small-or-large-numbers-when-doing-computation/m-p/94113#M609</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's another example. If you run this code, it quits after just over 1000 iterations, even though theoretically smallnum should never become zero. It's quite possible that the result that is causing you problems is actually zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All of the preceding advice is correct; you should consider ways to restructure your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data nums;&lt;BR /&gt; smallnum = 1;&lt;BR /&gt; stopflag = 0;&lt;/P&gt;&lt;P&gt; do i = 1 to 1000000 while(stopflag = 0);&lt;BR /&gt;&amp;nbsp; smallnum = smallnum / 2;&lt;BR /&gt;&amp;nbsp; testnum = 1 / smallnum;&lt;BR /&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if smallnum = 0 then&lt;BR /&gt;&amp;nbsp;&amp;nbsp; stopflag = 1;&lt;BR /&gt; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Jun 2013 15:52:50 GMT</pubDate>
    <dc:creator>TomKari</dc:creator>
    <dc:date>2013-06-04T15:52:50Z</dc:date>
    <item>
      <title>how to deal very small or large numbers when doing computation using SAS?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/how-to-deal-very-small-or-large-numbers-when-doing-computation/m-p/94109#M605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm doing some computations using SAS. In my formula, I have to divide a variable which I know it is not ZERO. But because it is very very small, SAS recognizes it as a ZERO, and gives me errors when processing the calculation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What can I do to make SAS to increase the degree of accuracy when dealing with numbers? Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Grace.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Jun 2013 23:18:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/how-to-deal-very-small-or-large-numbers-when-doing-computation/m-p/94109#M605</guid>
      <dc:creator>grace_in_learning</dc:creator>
      <dc:date>2013-06-03T23:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to deal very small or large numbers when doing computation using SAS?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/how-to-deal-very-small-or-large-numbers-when-doing-computation/m-p/94110#M606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As far as I know, SAS does all it's computations using double precision floating point numbers and never goes beyond that precision. Within those limits, it tries to avoid rounding error and numerical instability. The most common approach when dealing with very large or very small numbers involves rescaling your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, in the following datastep, an error occurs only when z is calculated :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data _null_;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;x = 1e-200;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;y = 1e200;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;t = 1 / x;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;z = y / x;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2013 02:46:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/how-to-deal-very-small-or-large-numbers-when-doing-computation/m-p/94110#M606</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-06-04T02:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to deal very small or large numbers when doing computation using SAS?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/how-to-deal-very-small-or-large-numbers-when-doing-computation/m-p/94111#M607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post an example of the calculation causing the problem? Dividing by a very small number may result in a very large number that could be meaningless in the context of how you want to use it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2013 03:44:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/how-to-deal-very-small-or-large-numbers-when-doing-computation/m-p/94111#M607</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2013-06-04T03:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to deal very small or large numbers when doing computation using SAS?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/how-to-deal-very-small-or-large-numbers-when-doing-computation/m-p/94112#M608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another thing you might try is changing the order of your computations. It may be that your very small numbers are intermediary results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, it never hurts to go back to the assumptions of the model. Is it really meaningful in the real world problem you are trying to solve to divide by such a small number? Maybe there is a special condition in practice when measurements are very close to zero?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2013 05:34:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/how-to-deal-very-small-or-large-numbers-when-doing-computation/m-p/94112#M608</guid>
      <dc:creator>LeoLopes</dc:creator>
      <dc:date>2013-06-04T05:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to deal very small or large numbers when doing computation using SAS?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/how-to-deal-very-small-or-large-numbers-when-doing-computation/m-p/94113#M609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's another example. If you run this code, it quits after just over 1000 iterations, even though theoretically smallnum should never become zero. It's quite possible that the result that is causing you problems is actually zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All of the preceding advice is correct; you should consider ways to restructure your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data nums;&lt;BR /&gt; smallnum = 1;&lt;BR /&gt; stopflag = 0;&lt;/P&gt;&lt;P&gt; do i = 1 to 1000000 while(stopflag = 0);&lt;BR /&gt;&amp;nbsp; smallnum = smallnum / 2;&lt;BR /&gt;&amp;nbsp; testnum = 1 / smallnum;&lt;BR /&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if smallnum = 0 then&lt;BR /&gt;&amp;nbsp;&amp;nbsp; stopflag = 1;&lt;BR /&gt; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2013 15:52:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/how-to-deal-very-small-or-large-numbers-when-doing-computation/m-p/94113#M609</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2013-06-04T15:52:50Z</dc:date>
    </item>
  </channel>
</rss>

