<?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: Value should be 0 but it is am extreme small number in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Value-should-be-0-but-it-is-am-extreme-small-number/m-p/710739#M218849</link>
    <description>&lt;P&gt;Sas numeric variables are saved, even integers, as exponential.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are computing daily change/return. Usually you need 2 decimal digits.&lt;/P&gt;
&lt;P&gt;For reporting use a format like 12.2.&lt;/P&gt;
&lt;P&gt;For checking is the value zero round or use the int() function.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Jan 2021 07:29:52 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2021-01-12T07:29:52Z</dc:date>
    <item>
      <title>Value should be 0 but it is am extreme small number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Value-should-be-0-but-it-is-am-extreme-small-number/m-p/710709#M218837</link>
      <description>&lt;P&gt;I am computing the daily change/return of a series. In many cases, the value should be 0 because the value does not change. However, instead of 0, SAS produces extremely small values such as&amp;nbsp;-3.76158E-37. What is going on? I read somewhere that sometimes the computer does that but cannot remember why/how. How do I address this issue apart from rounding the number such as&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;change = round (value/value_lag1, 0.0000000001)&lt;/PRE&gt;
&lt;P&gt;Not sure if it helps but the time series variable has an informat 12. and format best12.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;toin the direction ofMore (Definitions, Synonyms, Translation)&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 00:25:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Value-should-be-0-but-it-is-am-extreme-small-number/m-p/710709#M218837</guid>
      <dc:creator>somebody</dc:creator>
      <dc:date>2021-01-12T00:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Value should be 0 but it is am extreme small number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Value-should-be-0-but-it-is-am-extreme-small-number/m-p/710738#M218848</link>
      <description>&lt;P&gt;The issue is called "precision" and all computers have limits as to how many decimal can be stored in binary form. Depending on how many bits a numeric value can be used to store values determines how many digits are accurately represented. The more calculations involved the more likely that you start loosing small amounts at the limits of storage and can generate internal round-off errors such as you see. With SAS the typical limit is 15 or 16 significant digits depending on operating system. &lt;/P&gt;
&lt;P&gt;All irrational or repeating decimals have such an issue and never fit exactly. 1/3 is 0.3333333333333333 (until you get tired of typing 3 and it still goes on).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if that is your need then controlling the result of your calculations by rounding, truncating or other approach may be required. You might find the FUZZ function of use as it returns the nearest integer if the value is within 1E-12 of an integer.&lt;/P&gt;
&lt;PRE&gt;change = fuzz (value/value_lag1);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 07:23:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Value-should-be-0-but-it-is-am-extreme-small-number/m-p/710738#M218848</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-12T07:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Value should be 0 but it is am extreme small number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Value-should-be-0-but-it-is-am-extreme-small-number/m-p/710739#M218849</link>
      <description>&lt;P&gt;Sas numeric variables are saved, even integers, as exponential.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are computing daily change/return. Usually you need 2 decimal digits.&lt;/P&gt;
&lt;P&gt;For reporting use a format like 12.2.&lt;/P&gt;
&lt;P&gt;For checking is the value zero round or use the int() function.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 07:29:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Value-should-be-0-but-it-is-am-extreme-small-number/m-p/710739#M218849</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-01-12T07:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Value should be 0 but it is am extreme small number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Value-should-be-0-but-it-is-am-extreme-small-number/m-p/710771#M218854</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/98381"&gt;@somebody&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At first glance this looks like yet another rounding issue related to precision and numeric representation errors which have been discussed in a &lt;A href="https://communities.sas.com/t5/forums/searchpage/tab/message?filter=authorId&amp;amp;q=%22numeric%20representation%22&amp;amp;noSynonym=false&amp;amp;advanced=true&amp;amp;author_id=32733&amp;amp;collapse_discussion=true&amp;amp;search_type=thread" target="_blank" rel="noopener"&gt;number of threads&lt;/A&gt;. However, your example is somewhat special in two ways:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/98381"&gt;@somebody&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am computing the daily change/return of a series. In many cases, the value should be 0 because the value does not change.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
If the value in the series &lt;EM&gt;really&lt;/EM&gt; doesn't change, the standard formulas for change or return should &lt;EM&gt;not&lt;/EM&gt; produce those tiny differences. So I suspect that the input values already are affected by rounding errors and only the formatted display ("best12.") makes them appear equal.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Typically, the tiny differences between two numbers that "should actually be equal" amount to small integer multiples of the place value of the least significant bit. For example, in SAS on Windows and Unix platforms the place value of the least significant bit of a number &lt;EM&gt;x&lt;/EM&gt; with 1 &amp;lt;= &lt;EM&gt;x&lt;/EM&gt; &amp;lt; 2 (i.e., "order of magnitude 2**0") is 2**−52=2.2204...E−16. More generally, it's 2**(−52+&lt;EM&gt;k&lt;/EM&gt;) for numbers in the order of magnitude 2**&lt;EM&gt;k&lt;/EM&gt;. So it's plausible why, e.g.,&amp;nbsp;&lt;FONT face="courier new,courier"&gt;0.8-0.1-0.7=2**-53&lt;/FONT&gt; (Windows SAS) because the &lt;EM&gt;k&lt;/EM&gt; for 0.8 and 0.7 is −1 (and −4 for 0.1).&lt;BR /&gt;The fact that 2**−121=3.76158...E−37 suggests that your "extremely small values" were produced in the context of numbers in the order of magnitude 2**(−121+52)=2**−69=1.694...E−21, which is extremely small itself and obviously much smaller than what one would expect to see in financial time series.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;It would be interesting to see an example of two (seemingly) equal values of your time series, the formula (and the operating system) used to compute the change or return and the resulting tiny difference.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 10:32:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Value-should-be-0-but-it-is-am-extreme-small-number/m-p/710771#M218854</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-01-12T10:32:34Z</dc:date>
    </item>
  </channel>
</rss>

