<?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: Default length of a numeric variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Default-length-of-a-numeric-variable/m-p/667014#M199677</link>
    <description>&lt;P&gt;LENGTH is a character function. You are asking for the character length of a numeric variable. A read of the LENGTH documentation will tell you:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;If string is a numeric constant, variable, or expression (either initialized or uninitialized), SAS automatically converts the numeric value to a right-justified character string by using the BEST12. format. In this case, LENGTH returns a value of 12 and writes a note in the SAS log stating that the numeric values have been converted to character values.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Important take away.... read the log.&lt;/P&gt;</description>
    <pubDate>Sun, 05 Jul 2020 13:52:52 GMT</pubDate>
    <dc:creator>RichardDeVen</dc:creator>
    <dc:date>2020-07-05T13:52:52Z</dc:date>
    <item>
      <title>Default length of a numeric variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Default-length-of-a-numeric-variable/m-p/667013#M199676</link>
      <description>&lt;P&gt;Hi, I have learned that the default length of a numeric variable is 8. However, when I use the length statement on a numeric variable, it returns 12.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data test;
a = 1;
len = length(a);
run;&lt;/PRE&gt;&lt;P&gt;The result is 12:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="i1001.png" style="width: 822px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46906i016A7A9B7921C9C8/image-size/large?v=v2&amp;amp;px=999" role="button" title="i1001.png" alt="i1001.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jul 2020 13:39:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Default-length-of-a-numeric-variable/m-p/667013#M199676</guid>
      <dc:creator>kisumsam</dc:creator>
      <dc:date>2020-07-05T13:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Default length of a numeric variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Default-length-of-a-numeric-variable/m-p/667014#M199677</link>
      <description>&lt;P&gt;LENGTH is a character function. You are asking for the character length of a numeric variable. A read of the LENGTH documentation will tell you:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;If string is a numeric constant, variable, or expression (either initialized or uninitialized), SAS automatically converts the numeric value to a right-justified character string by using the BEST12. format. In this case, LENGTH returns a value of 12 and writes a note in the SAS log stating that the numeric values have been converted to character values.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Important take away.... read the log.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jul 2020 13:52:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Default-length-of-a-numeric-variable/m-p/667014#M199677</guid>
      <dc:creator>RichardDeVen</dc:creator>
      <dc:date>2020-07-05T13:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: Default length of a numeric variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Default-length-of-a-numeric-variable/m-p/667016#M199678</link>
      <description>Great thanks!</description>
      <pubDate>Sun, 05 Jul 2020 14:02:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Default-length-of-a-numeric-variable/m-p/667016#M199678</guid>
      <dc:creator>kisumsam</dc:creator>
      <dc:date>2020-07-05T14:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: Default length of a numeric variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Default-length-of-a-numeric-variable/m-p/667017#M199679</link>
      <description>&lt;P&gt;You are comparing apples and oranges.&lt;/P&gt;
&lt;P&gt;The LENGTH() function returns the length of a &lt;STRONG&gt;value&lt;/STRONG&gt;, not the storage length of the &lt;STRONG&gt;variable&lt;/STRONG&gt;.&amp;nbsp; Use the &lt;STRONG&gt;VLENGTH()&lt;/STRONG&gt; function to find out the defined storage length for a variable.&amp;nbsp; The reason you get 12 is because the LENGTH() function works on character strings, not numbers.&amp;nbsp; SAS will convert the number to a character string using the BEST12 format.&amp;nbsp; So no matter what numeric value you try to pass to the LENGTH() function the answer will always be 12.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jul 2020 14:02:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Default-length-of-a-numeric-variable/m-p/667017#M199679</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-07-05T14:02:27Z</dc:date>
    </item>
  </channel>
</rss>

