<?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: Question: the numerical variables' width and value? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Question-the-numerical-variables-width-and-value/m-p/768976#M30829</link>
    <description>&lt;P&gt;SAS stores numbers as 64 bit floating point numbers.&amp;nbsp; Think of scientific notation (3.5E13) only using base 2 instead of base 10.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So part of those 64 bits are reserved for storing the magnitude.&amp;nbsp; When you restrict the storage to just 3 of the 8 bytes you do NOT have 3*8 = 24 bits left for storing the actual number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2**13 = 8,192 so 11 of the 24 bits are used to store the magnitude.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Sep 2021 23:43:24 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-09-21T23:43:24Z</dc:date>
    <item>
      <title>Question: the numerical variables' width and value?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-the-numerical-variables-width-and-value/m-p/768968#M30828</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm confused with the numerical variable's width and its maximum value?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- The following is from the book: 3 bytes -&amp;gt; 8192, 4 bytes -&amp;gt; 2097152 ...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jz127323_0-1632263421079.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63841iB4DE930B2D2E959E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jz127323_0-1632263421079.png" alt="jz127323_0-1632263421079.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;- But in my understanding, the maximum values are: 3 bytes -&amp;gt; 2 ** 24 -1 = 16,777,215, 4 bytes -&amp;gt;&amp;nbsp;&lt;SPAN&gt;4,294,967,295 ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So, I don't understand the logic in&amp;nbsp; SAS's bytes in variable definition?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;James&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 22:40:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-the-numerical-variables-width-and-value/m-p/768968#M30828</guid>
      <dc:creator>jz127323</dc:creator>
      <dc:date>2021-09-21T22:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Question: the numerical variables' width and value?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-the-numerical-variables-width-and-value/m-p/768976#M30829</link>
      <description>&lt;P&gt;SAS stores numbers as 64 bit floating point numbers.&amp;nbsp; Think of scientific notation (3.5E13) only using base 2 instead of base 10.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So part of those 64 bits are reserved for storing the magnitude.&amp;nbsp; When you restrict the storage to just 3 of the 8 bytes you do NOT have 3*8 = 24 bits left for storing the actual number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2**13 = 8,192 so 11 of the 24 bits are used to store the magnitude.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 23:43:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-the-numerical-variables-width-and-value/m-p/768976#M30829</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-09-21T23:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: Question: the numerical variables' width and value?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-the-numerical-variables-width-and-value/m-p/768978#M30830</link>
      <description>&lt;P&gt;First, 8,192 is the maximum CONSECUTIVE integer that SAS will store as a 3-byte field.&amp;nbsp; But that storage format will also hold larger values, for instance&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;every even number from 8,192 to 2*8,192&lt;/LI&gt;
&lt;LI&gt;every 0mod4 number from 2*8,192 to 4*8,192&lt;/LI&gt;
&lt;LI&gt;etc.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;BTW, it would also hold&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;every integer from 8,192 down to 4,096,&lt;/LI&gt;
&lt;LI&gt;then every half&amp;nbsp; (i.e. 0mod(0.5) from 4,096 down to 2,048&lt;/LI&gt;
&lt;LI&gt;etc.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Secondly, your use of the 24 bits is thinking in terms of integer storage, but SAS uses a floating point storage format, reserving&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;1 bit for sign&lt;/LI&gt;
&lt;LI&gt;11 bits for exponent&lt;/LI&gt;
&lt;LI&gt;12 bits (=24 - 1 - 11) for mantissa&amp;nbsp; &amp;nbsp;(which would be 52 bits using the default 8-byte numeric storage).&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;For a 12 bit mantissa, the largest consecutive integer storable would be 2**13 (=8,192).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 00:01:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-the-numerical-variables-width-and-value/m-p/768978#M30830</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-09-22T00:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: Question: the numerical variables' width and value?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-the-numerical-variables-width-and-value/m-p/769967#M30848</link>
      <description>&lt;P&gt;thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 16:29:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-the-numerical-variables-width-and-value/m-p/769967#M30848</guid>
      <dc:creator>jz127323</dc:creator>
      <dc:date>2021-09-23T16:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: Question: the numerical variables' width and value?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-the-numerical-variables-width-and-value/m-p/769968#M30849</link>
      <description>&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 16:30:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-the-numerical-variables-width-and-value/m-p/769968#M30849</guid>
      <dc:creator>jz127323</dc:creator>
      <dc:date>2021-09-23T16:30:16Z</dc:date>
    </item>
  </channel>
</rss>

