<?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: Display variable properly (BESTw.d) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Display-variable-properly-BESTw-d/m-p/263472#M51561</link>
    <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try applying the format to the variable: &lt;STRONG&gt;format CtrcN best14.;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Apr 2016 11:03:18 GMT</pubDate>
    <dc:creator>Loko</dc:creator>
    <dc:date>2016-04-13T11:03:18Z</dc:date>
    <item>
      <title>Display variable properly (BESTw.d)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-variable-properly-BESTw-d/m-p/263470#M51560</link>
      <description>&lt;P&gt;I'm on SAS version 5.1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a database I have a numeric variable called CtrcN whose entries are 14 digit numbers. They are displayed as, for example, 4.2000001E13 instead of 42000001251100.&lt;/P&gt;&lt;P&gt;In order to try to fix this I use the following code.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;DATA nameofoutputdatabase;&lt;BR /&gt;SET nameofinputdatabse;&lt;BR /&gt;CtrcN_Aux=input(CtrcN,BEST14.);&lt;BR /&gt;RUN;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;(I used an auxiliary variable just to avoid possible issues with writing over the same variable).&lt;/P&gt;&lt;P&gt;The variable CtrcN_Aux still comes looking like 4.2000001E13.&lt;/P&gt;&lt;P&gt;A possible fix to this is to change it into a character variable, but I don't want this. Another one is to define the format in a PROC SQL, which I also do not want to do.&lt;/P&gt;&lt;P&gt;What can I do in order to display the variable as 42000001251100 instead of 4.2000001E13 by using a DATA ; SET ; RUN ;?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 10:53:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-variable-properly-BESTw-d/m-p/263470#M51560</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2016-04-13T10:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: Display variable properly (BESTw.d)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-variable-properly-BESTw-d/m-p/263472#M51561</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try applying the format to the variable: &lt;STRONG&gt;format CtrcN best14.;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 11:03:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-variable-properly-BESTw-d/m-p/263472#M51561</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2016-04-13T11:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: Display variable properly (BESTw.d)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-variable-properly-BESTw-d/m-p/263473#M51562</link>
      <description>Perfect. Simple and efficient.&lt;BR /&gt;Why isn't my method working, though?</description>
      <pubDate>Wed, 13 Apr 2016 11:06:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-variable-properly-BESTw-d/m-p/263473#M51562</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2016-04-13T11:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Display variable properly (BESTw.d)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-variable-properly-BESTw-d/m-p/263475#M51564</link>
      <description>&lt;P&gt;because &lt;STRONG&gt;input&lt;/STRONG&gt; is for transforming character variable to numeric format. Your variable is already a numeric variable and if you check&lt;/P&gt;&lt;P&gt;the log you will notice the message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;Numeric values have been converted to character values at the places given by: (Line):(Column)...&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This means your numeric variable used in the function (CtrcN) is converted by sas to a character one using best12. format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More on &lt;STRONG&gt;input:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000180357.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000180357.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 11:11:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-variable-properly-BESTw-d/m-p/263475#M51564</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2016-04-13T11:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Display variable properly (BESTw.d)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-variable-properly-BESTw-d/m-p/263476#M51565</link>
      <description>Thank you very much.&lt;BR /&gt;&lt;BR /&gt;Very informative.</description>
      <pubDate>Wed, 13 Apr 2016 11:15:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-variable-properly-BESTw-d/m-p/263476#M51565</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2016-04-13T11:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Display variable properly (BESTw.d)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-variable-properly-BESTw-d/m-p/263477#M51566</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/80979"&gt;@sleretrano﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-- I just notice that Loko has already given the explanation, while I was writing this --&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume, with "database" you mean "SAS dataset." It was a good idea to store the result of the INPUT function in a new variable, because in general the expression&amp;nbsp;&lt;SPAN&gt;input(CtrcN,BEST14.)&amp;nbsp;returns a different value than CtrcN:&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN&gt;Since the INPUT function expects a character expression as its first argument, the value in CtrcN is automatically converted to a character string (see corresponding NOTE in the log!) using the default numeric format BEST12., which turns 42000001251100 into "4.2000001E13". Please note that the information contained in the last six digits (251100) is already lost at this point!&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Reading the string&amp;nbsp;"&lt;SPAN&gt;4.2000001E13" with informat BEST14. results in the number&amp;nbsp;4.2000001E13, i.e.,&amp;nbsp;42000001000000.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is not what you want. Instead, don't touch the numeric value and just apply an appropriate format like BEST14. for display purposes, as Loko has suggested. If all the numbers in CtrcN are integers of (up to) 14 digits, format 14. would do as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 11:27:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-variable-properly-BESTw-d/m-p/263477#M51566</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-04-13T11:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Display variable properly (BESTw.d)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-variable-properly-BESTw-d/m-p/263479#M51567</link>
      <description>Thank you. I'm new to SAS, I don't know the standard terminology yet. This was helpful.</description>
      <pubDate>Wed, 13 Apr 2016 11:37:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-variable-properly-BESTw-d/m-p/263479#M51567</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2016-04-13T11:37:58Z</dc:date>
    </item>
  </channel>
</rss>

