<?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: Why SAS is storing 0.0999999642 instead of 0.1 in the X? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-SAS-is-storing-0-0999999642-instead-of-0-1-in-the-X/m-p/115340#M23755</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your statement "&lt;SPAN style="font-weight: bold; font-size: 12pt; color: black; font-family: 'times new roman', times;"&gt;If the length of the variable is 4 bytes , SAS can store any value less than &lt;SPAN style="color: black;"&gt;2,097,152 correctly without affecting its &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: bold; font-size: 12pt; color: black; font-family: 'times new roman', times;"&gt;precision.&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; color: black; font-family: 'times new roman', times;"&gt;" is wrong. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;When thinking about changing the length of a numeric variable, you must consider whether the variable will only contain integers. If so, then changing the length is a legitimate way to save space. However, if there's any chance the variable will contain fractional values, then you should leave the length at 8 bytes. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 May 2012 14:01:16 GMT</pubDate>
    <dc:creator>FloydNevseta</dc:creator>
    <dc:date>2012-05-15T14:01:16Z</dc:date>
    <item>
      <title>Why SAS is storing 0.0999999642 instead of 0.1 in the X?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-SAS-is-storing-0-0999999642-instead-of-0-1-in-the-X/m-p/115336#M23751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt;Hello Friends,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt;I have question regarding the way SAS Stores the Numeric Values. I understood that SAS will store the numeric&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt;values as Floating point numbers. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt;If the length of the variable is 4 bytes , SAS can store any value less than &lt;SPAN style="color: black;"&gt;2,097,152 correctly without affecting its &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 12pt; font-family: 'times new roman', times; font-weight: bold;"&gt;precision.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt;&lt;SPAN&gt;I didnt understood why SAS is storing &lt;SPAN style="color: #000000; font-weight: bold;"&gt;? instead of 0.1 in the X Variable(Refer the Program).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 12pt; font-family: 'times new roman', times; font-weight: bold;"&gt;Please, I request you to clarify my doubt.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12pt; font-family: 'times new roman', times;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt;&lt;SPAN&gt;Following is the program , to understand my question clearly.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt; data test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt; length x 4;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt; X=1/10;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt; Y=1/10;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt; data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt; set test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt; put X=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt; put Y=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt;Log Output:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt;x=0.0999999642&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt;y=0.1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt;Thank you,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-weight: bold; font-family: 'times new roman', times; font-size: 12pt;"&gt;John&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 09:24:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-SAS-is-storing-0-0999999642-instead-of-0-1-in-the-X/m-p/115336#M23751</guid>
      <dc:creator>john83</dc:creator>
      <dc:date>2012-05-15T09:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Why SAS is storing 0.0999999642 instead of 0.1 in the X?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-SAS-is-storing-0-0999999642-instead-of-0-1-in-the-X/m-p/115337#M23752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually in the computer, you can't store 0.1 exactly . &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 10:14:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-SAS-is-storing-0-0999999642-instead-of-0-1-in-the-X/m-p/115337#M23752</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-05-15T10:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why SAS is storing 0.0999999642 instead of 0.1 in the X?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-SAS-is-storing-0-0999999642-instead-of-0-1-in-the-X/m-p/115338#M23753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Two links adding a bit of flesh to what Ksharp tells you.&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000695157.htm"&gt;http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000695157.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/techsup/technote/ts654.pdf" title="http://support.sas.com/techsup/technote/ts654.pdf"&gt;http://support.sas.com/techsup/technote/ts654.pdf&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 11:37:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-SAS-is-storing-0-0999999642-instead-of-0-1-in-the-X/m-p/115338#M23753</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-05-15T11:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: Why SAS is storing 0.0999999642 instead of 0.1 in the X?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-SAS-is-storing-0-0999999642-instead-of-0-1-in-the-X/m-p/115339#M23754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The references are great.&amp;nbsp; Here's another way to look at it.&amp;nbsp; I"m not sure if this helps or not, but just in case it does ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "largest number" you picked out as actually the largest integer value that can be stored precisely.&amp;nbsp; There are other numbers, both large and small that can be stored precisely if they fit into the available number of bits.&amp;nbsp; For example, 0.75 can be stored precisely because it takes only two bits to store the value.&amp;nbsp; In a binary system, one bit turned on is 1/2 (or 2**-1), and the next bit turned on is 1/4 (or 2**-2).&amp;nbsp; So 0.75 fits exactly.&amp;nbsp; You can store larger EVEN integers than the "largest integer" because they can drop the "1's" bit and not lose any precision. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 13:03:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-SAS-is-storing-0-0999999642-instead-of-0-1-in-the-X/m-p/115339#M23754</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-05-15T13:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Why SAS is storing 0.0999999642 instead of 0.1 in the X?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-SAS-is-storing-0-0999999642-instead-of-0-1-in-the-X/m-p/115340#M23755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your statement "&lt;SPAN style="font-weight: bold; font-size: 12pt; color: black; font-family: 'times new roman', times;"&gt;If the length of the variable is 4 bytes , SAS can store any value less than &lt;SPAN style="color: black;"&gt;2,097,152 correctly without affecting its &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: bold; font-size: 12pt; color: black; font-family: 'times new roman', times;"&gt;precision.&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; color: black; font-family: 'times new roman', times;"&gt;" is wrong. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;When thinking about changing the length of a numeric variable, you must consider whether the variable will only contain integers. If so, then changing the length is a legitimate way to save space. However, if there's any chance the variable will contain fractional values, then you should leave the length at 8 bytes. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 14:01:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-SAS-is-storing-0-0999999642-instead-of-0-1-in-the-X/m-p/115340#M23755</guid>
      <dc:creator>FloydNevseta</dc:creator>
      <dc:date>2012-05-15T14:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Why SAS is storing 0.0999999642 instead of 0.1 in the X?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-SAS-is-storing-0-0999999642-instead-of-0-1-in-the-X/m-p/115341#M23756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everybody.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 16:34:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-SAS-is-storing-0-0999999642-instead-of-0-1-in-the-X/m-p/115341#M23756</guid>
      <dc:creator>john83</dc:creator>
      <dc:date>2012-05-16T16:34:01Z</dc:date>
    </item>
  </channel>
</rss>

