<?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: Import numeric values with best32. format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Import-numeric-values-with-best32-format/m-p/784116#M250161</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292396"&gt;@David_Billa&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;Thank you for your input. I just realized that we've used proc import to import data and then used data step to format the values. When I used commax12.10, I'm getting the values with correct number of decimal places but with 0s added to it at last instead of actual numbers. See below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;0.0515609000&lt;/P&gt;
&lt;P&gt;0.2135470980&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Upon quick check, I see that proc import causing one of the value to trim as shown below. My question is why it is trimming only one of its value in proc import?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;0.0515609&lt;/P&gt;
&lt;P&gt;0.213547098&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Expected behavior for any fixed decimal format. ALWAYS consider format when looking at results.&lt;/P&gt;
&lt;P&gt;Even when you don't assign a format SAS does and may result in appearance you don't expect.&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>Sat, 04 Dec 2021 19:06:49 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-12-04T19:06:49Z</dc:date>
    <item>
      <title>Import numeric values with best32. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-numeric-values-with-best32-format/m-p/784050#M250127</link>
      <description>&lt;P&gt;I'm trying to Import the following values via data step infile statement from .xls and I see that one of the value is rounded off and it should not be. Any help to resolve the issue?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;0,051560936512756&lt;/P&gt;
&lt;P&gt;0,213547098412685&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code which I used is,&lt;/P&gt;
&lt;PRE&gt;(input(A,Best32.)) as values length = 8&lt;/PRE&gt;
&lt;P&gt;Output which I got is,&lt;/P&gt;
&lt;P&gt;0.0515609&lt;/P&gt;
&lt;P&gt;0.213547098&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Excepted Output: &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;0,051560937&lt;/P&gt;
&lt;P&gt;0,213547098&lt;/P&gt;</description>
      <pubDate>Sat, 04 Dec 2021 07:41:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-numeric-values-with-best32-format/m-p/784050#M250127</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2021-12-04T07:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: Import numeric values with best32. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-numeric-values-with-best32-format/m-p/784051#M250128</link>
      <description>&lt;P&gt;Use a format in your SQL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;(input(A,Best32.)) as values format=commax12.10&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Untested, posted from my tablet.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Dec 2021 07:46:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-numeric-values-with-best32-format/m-p/784051#M250128</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-12-04T07:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Import numeric values with best32. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-numeric-values-with-best32-format/m-p/784052#M250129</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;Thank you for your input. I just realized that we've used proc import to import data and then used data step to format the values. When I used commax12.10, I'm getting the values with correct number of decimal places but with 0s added to it at last instead of actual numbers. See below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;0.0515609000&lt;/P&gt;
&lt;P&gt;0.2135470980&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Upon quick check, I see that proc import causing one of the value to trim as shown below. My question is why it is trimming only one of its value in proc import?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;0.0515609&lt;/P&gt;
&lt;P&gt;0.213547098&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>Sat, 04 Dec 2021 08:05:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-numeric-values-with-best32-format/m-p/784052#M250129</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2021-12-04T08:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Import numeric values with best32. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-numeric-values-with-best32-format/m-p/784062#M250131</link>
      <description>&lt;P&gt;The usual advice: do not use Excel files and PROC IMPORT. Save as csv, and read that with a data step where you have full control over informats and other variable attributes.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Dec 2021 08:58:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-numeric-values-with-best32-format/m-p/784062#M250131</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-12-04T08:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Import numeric values with best32. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-numeric-values-with-best32-format/m-p/784100#M250149</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292396"&gt;@David_Billa&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;Thank you for your input. I just realized that we've used proc import to import data and then used data step to format the values. When I used commax12.10, I'm getting the values with correct number of decimal places but with 0s added to it at last instead of actual numbers. See below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;0.0515609000&lt;/P&gt;
&lt;P&gt;0.2135470980&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Upon quick check, I see that proc import causing one of the value to trim as shown below. My question is why it is trimming only one of its value in proc import?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;0.0515609&lt;/P&gt;
&lt;P&gt;0.213547098&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't see any examples of "trimmed" values in this post.&amp;nbsp; Do you have some examples you can share?&lt;/P&gt;
&lt;P&gt;If you have a numeric variable the way the number is printed (the FORMAT) does not have any impact on what is stored.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The INPUT() function operate on character strings.&amp;nbsp; So if you have a numeric variable and try to use it as an argument to the INPUT() function then SAS will first convert the number to a character string using the BEST12. format.&amp;nbsp; You should see notes in the SAS log about converting numbers to characters if you do that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note that BEST is the name of a FORMAT.&amp;nbsp; It is a format that will try how to "best" display the value of a number using a fixed number of characters. It does this by picking a number of decimal places that will fit and switching to scientific notation if needed.&amp;nbsp; There is no corresponding concept of the "best" way to read text into a number, you just want to create the number that the text represents.&amp;nbsp; So if you use BEST as an INFORMAT then SAS will just replace it with the normal numeric informat instead.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Dec 2021 17:43:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-numeric-values-with-best32-format/m-p/784100#M250149</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-12-04T17:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Import numeric values with best32. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-numeric-values-with-best32-format/m-p/784116#M250161</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292396"&gt;@David_Billa&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;Thank you for your input. I just realized that we've used proc import to import data and then used data step to format the values. When I used commax12.10, I'm getting the values with correct number of decimal places but with 0s added to it at last instead of actual numbers. See below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;0.0515609000&lt;/P&gt;
&lt;P&gt;0.2135470980&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Upon quick check, I see that proc import causing one of the value to trim as shown below. My question is why it is trimming only one of its value in proc import?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;0.0515609&lt;/P&gt;
&lt;P&gt;0.213547098&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Expected behavior for any fixed decimal format. ALWAYS consider format when looking at results.&lt;/P&gt;
&lt;P&gt;Even when you don't assign a format SAS does and may result in appearance you don't expect.&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>Sat, 04 Dec 2021 19:06:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-numeric-values-with-best32-format/m-p/784116#M250161</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-12-04T19:06:49Z</dc:date>
    </item>
  </channel>
</rss>

