<?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: character to numeric conversion in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/character-to-numeric-conversion/m-p/387243#M92828</link>
    <description>&lt;P&gt;Use the notdigit() function on a substring to determine if it's truly numeric before converting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The .D... notation is mentioned in the &lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000204411.htm" target="_blank"&gt;9.2 documentation for the Ew.d informat&lt;/A&gt; (which is just an alias for w.d in 9.4) as a valid numeric notation.&lt;/P&gt;</description>
    <pubDate>Fri, 11 Aug 2017 07:15:27 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-08-11T07:15:27Z</dc:date>
    <item>
      <title>character to numeric conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/character-to-numeric-conversion/m-p/386959#M92724</link>
      <description>&lt;P&gt;Below code is auto converting value 9d10 to 9e10.It is an account id column loaded into sas from TD.In TD the value is 9d10 whereas in SAS 9E100.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;x=9d10;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In test dataset the value of x is shown as 9e10.Anybody has any thoughts on why&amp;nbsp;this happens?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 12:18:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/character-to-numeric-conversion/m-p/386959#M92724</guid>
      <dc:creator>Explore_SAS9</dc:creator>
      <dc:date>2017-08-10T12:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: character to numeric conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/character-to-numeric-conversion/m-p/386961#M92725</link>
      <description>&lt;P&gt;The reason is that the variable X, for which you supply no information, is being created as length 8 numeric variable. &amp;nbsp;Now 9d10 can be a number and can be represented as 9e10, or 9 to 10 places. &amp;nbsp;You have not said what you want the variable to be? &amp;nbsp;Maybe character (even if not, it is always good to state what type and length your varaibles are):&lt;/P&gt;
&lt;PRE&gt;data test;
  length x $20;
  x="9d10";
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Aug 2017 12:25:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/character-to-numeric-conversion/m-p/386961#M92725</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-08-10T12:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: character to numeric conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/character-to-numeric-conversion/m-p/386963#M92727</link>
      <description>&lt;P&gt;Strings need to be marked as such, use quotes:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
x="9d10";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Aug 2017 12:27:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/character-to-numeric-conversion/m-p/386963#M92727</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-10T12:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: character to numeric conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/character-to-numeric-conversion/m-p/387242#M92827</link>
      <description>&lt;P&gt;Actually the data for account id is wrong in the source file itself.It should be a numeric value but is coming as a character.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More on teh background:&lt;/P&gt;&lt;P&gt;An XML file line&amp;nbsp;is fed into a column in teradata table(used as source to SAS dataset).&lt;/P&gt;&lt;P&gt;In SAS that column is parsed using a macro and ACOOUNT value in xml&amp;nbsp;is assigned to numeric variable ACCOUNT.&lt;/P&gt;&lt;P&gt;But the xml data 9d100 in TD&amp;nbsp;is converted to 9e100 in sas and we are having question on why the difference in value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is what is the logic behind&amp;nbsp;9d100&amp;nbsp;being converted to 9e100 as we need to explain why the value is difefrent.&lt;/P&gt;&lt;P&gt;ACCOUNT column cannot be converted to character as it is inherently numeric.When there is a invalid value it should be same in Teradata and source&amp;nbsp;ideally.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 07:07:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/character-to-numeric-conversion/m-p/387242#M92827</guid>
      <dc:creator>Explore_SAS9</dc:creator>
      <dc:date>2017-08-11T07:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: character to numeric conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/character-to-numeric-conversion/m-p/387243#M92828</link>
      <description>&lt;P&gt;Use the notdigit() function on a substring to determine if it's truly numeric before converting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The .D... notation is mentioned in the &lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000204411.htm" target="_blank"&gt;9.2 documentation for the Ew.d informat&lt;/A&gt; (which is just an alias for w.d in 9.4) as a valid numeric notation.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 07:15:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/character-to-numeric-conversion/m-p/387243#M92828</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-11T07:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: character to numeric conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/character-to-numeric-conversion/m-p/387523#M92917</link>
      <description>&lt;P&gt;I do not understand your question. The numbers 9e100 and 9d100 are the same number. They both mean 9 times 10 raised to the 100th power. &amp;nbsp;In the old days of Fortran they used the D instead of the E to mean to use double precision (8 byte) floating point instead of single precision (4 bytes). &amp;nbsp;But in SAS all numbers are stored in 8 byte floating point.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the field is an ACCOUNT number then you should probably be treating it as a character string in SAS. You will never need to take the mean of an ACCOUNT number. &amp;nbsp;Also there is a limit to the number of digits that an 8 byte floating point number can represent exactly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;1     data _null_;
2       x=constant('exactint');
3       put x comma24. ;
4     run;

   9,007,199,254,740,992&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Aug 2017 01:20:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/character-to-numeric-conversion/m-p/387523#M92917</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-08-12T01:20:08Z</dc:date>
    </item>
  </channel>
</rss>

