<?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: numeric variables are truncated in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/numeric-variables-are-truncated/m-p/538868#M148383</link>
    <description>&lt;P&gt;Also,&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length BP 8.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is not valid syntax,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are mixing format and length syntax.&lt;/P&gt;
&lt;P&gt;You should have:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length BP 8;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do not mix what variable length and format are. Especially for numeric variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Numeric variables should always have a length of 8 bytes&lt;/U&gt;, unless you have a good reason to change this, and you know about the dramatic consequences a different value can have.&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, 27 Feb 2019 01:32:39 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2019-02-27T01:32:39Z</dc:date>
    <item>
      <title>numeric variables are truncated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/numeric-variables-are-truncated/m-p/538857#M148373</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 441px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27518iAB24AB4519152DCF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a column called 'bp' whose type is 9~10 digits integers. However, it shows only upto 8th digit. Appreciate if you could let me know what is the problem.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 00:38:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/numeric-variables-are-truncated/m-p/538857#M148373</guid>
      <dc:creator>monona</dc:creator>
      <dc:date>2019-02-27T00:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: numeric variables are truncated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/numeric-variables-are-truncated/m-p/538867#M148382</link>
      <description>&lt;P&gt;You set the INFORMAT to read 8 characters, but you are NOT using that for anything in your code.&lt;/P&gt;
&lt;P&gt;But in your INPUT() function call you also told it to only read 8 characters.&amp;nbsp; Change that to use more characters.&amp;nbsp; Go ahead and use 32 as that it max that the informat supports.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;bp = input(....., ??32.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You also might want to add a FORMAT statement to tell SAS how to display the value, although normally SAS will use BEST12. as the default and that should easily display 10 digit integers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the last data step you set the length of BP to 8 bytes (why you included a period in the LENGTH statement I don't know because2 lengths are always integer values).&amp;nbsp; That shouldn't change the value as SAS always processes numbers using 8 byte floating point format.&amp;nbsp; And if you did previous use a shorter length when create the data you are reading in that step the extra precision is lost so increasing it back to the normal 8 cannot find the missing bits of precision.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 01:21:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/numeric-variables-are-truncated/m-p/538867#M148382</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-02-27T01:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: numeric variables are truncated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/numeric-variables-are-truncated/m-p/538868#M148383</link>
      <description>&lt;P&gt;Also,&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length BP 8.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is not valid syntax,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are mixing format and length syntax.&lt;/P&gt;
&lt;P&gt;You should have:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length BP 8;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do not mix what variable length and format are. Especially for numeric variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Numeric variables should always have a length of 8 bytes&lt;/U&gt;, unless you have a good reason to change this, and you know about the dramatic consequences a different value can have.&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, 27 Feb 2019 01:32:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/numeric-variables-are-truncated/m-p/538868#M148383</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-02-27T01:32:39Z</dc:date>
    </item>
  </channel>
</rss>

