<?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: Format for Character to numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/702990#M215353</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* https://documentation.sas.com/?cdcId=vdmmlcdc&amp;amp;cdcVersion=8.1&amp;amp;docsetId=leforinforref&amp;amp;docsetTarget=n056hzkipsxpcbn11ww9i9i47l0h.htm&amp;amp;locale=en */
data test_comma;
	format h commax16.14;
	h=input('0,50708683901377',comma16.14);
	put h=;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 02 Dec 2020 07:33:39 GMT</pubDate>
    <dc:creator>hhinohar</dc:creator>
    <dc:date>2020-12-02T07:33:39Z</dc:date>
    <item>
      <title>Format for Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/702975#M215346</link>
      <description>&lt;P&gt;I've a value as '0,50708683901377' character and I want to convert it to numeric. After numeric conversion, I want the value as same as before I convert.&lt;/P&gt;
&lt;P&gt;I tried with the Format 21.4 and also NUMX18.10 but it's not producing the desired results. Any help with the Format to produce the desired value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I tried is,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(input(H,Best32.)) as Value length = 8
            format = 21.4
            informat = 21.4&lt;/PRE&gt;
&lt;P&gt;Desired result is, 0,50708683901377 as numeric&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 06:21:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/702975#M215346</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2020-12-02T06:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: Format for Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/702978#M215348</link>
      <description>&lt;P&gt;It seems that the comma inside the number is for decimal sign (0,5 = a half).&lt;/P&gt;
&lt;P&gt;in your case the number =&amp;nbsp;&lt;SPAN&gt;'0,50708683901377'&amp;nbsp; has 14 decimal digits.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Try using format 21.14&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 06:48:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/702978#M215348</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-12-02T06:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Format for Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/702979#M215349</link>
      <description>Yes I have a comma inside number. Should I use 21.14 instead of 21.14 as I&lt;BR /&gt;have 14 numbers after comma?&lt;BR /&gt;&lt;BR /&gt;Please help me understand this format.&lt;BR /&gt;</description>
      <pubDate>Wed, 02 Dec 2020 06:56:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/702979#M215349</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2020-12-02T06:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: Format for Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/702984#M215351</link>
      <description>&lt;P&gt;21.14 means 21 characters in whole, including the comma with 14 decimal digits, which leaves 6 characters for the integer. (6+1+14 = 21).&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 07:04:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/702984#M215351</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-12-02T07:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Format for Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/702990#M215353</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* https://documentation.sas.com/?cdcId=vdmmlcdc&amp;amp;cdcVersion=8.1&amp;amp;docsetId=leforinforref&amp;amp;docsetTarget=n056hzkipsxpcbn11ww9i9i47l0h.htm&amp;amp;locale=en */
data test_comma;
	format h commax16.14;
	h=input('0,50708683901377',comma16.14);
	put h=;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Dec 2020 07:33:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/702990#M215353</guid>
      <dc:creator>hhinohar</dc:creator>
      <dc:date>2020-12-02T07:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Format for Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/702991#M215354</link>
      <description>&lt;P&gt;As you have a decimal comma you need to use the "X" formats (commax, numx etc.).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case use &lt;STRONG&gt;NumX32.14&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;Even though NumX&lt;STRONG&gt;16&lt;/STRONG&gt;.14 would be enough to handle the width of &lt;U&gt;this&lt;/U&gt; string the next value could be&amp;nbsp;'65342522,50708683901377' which would require NumX&lt;STRONG&gt;23&lt;/STRONG&gt;.14.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data char2num;
	H = '0,50708683901377';
	Value = Input(H,numX32.14);
	Format Value NumX32.14;
	Put Value NumX32.14 ;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Dec 2020 07:36:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/702991#M215354</guid>
      <dc:creator>DanielRingqvist</dc:creator>
      <dc:date>2020-12-02T07:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Format for Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/703000#M215362</link>
      <description>Can we use commx32.14 format also?&lt;BR /&gt;</description>
      <pubDate>Wed, 02 Dec 2020 08:03:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/703000#M215362</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2020-12-02T08:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: Format for Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/703007#M215366</link>
      <description>Yes, in this case.&lt;BR /&gt;&lt;BR /&gt;But if your input value was  '65342522,50708683901377' it wouldn't work as CommaX looks for thousand separators.&lt;BR /&gt;&lt;BR /&gt;With  '65.342.522,50708683901377' you should use CommaX.</description>
      <pubDate>Wed, 02 Dec 2020 08:12:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/703007#M215366</guid>
      <dc:creator>DanielRingqvist</dc:creator>
      <dc:date>2020-12-02T08:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: Format for Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/703010#M215369</link>
      <description>Well, NumX formats can also be used in place of CommaX format?&lt;BR /&gt;</description>
      <pubDate>Wed, 02 Dec 2020 08:20:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/703010#M215369</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2020-12-02T08:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: Format for Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/703012#M215370</link>
      <description>&lt;P&gt;Do not use fractional parts in informats. If no comma is present in the string, the informat will first divide by 10**(fractional part), and then apply the format. A string of "1" would then result in 1e-14.&lt;/P&gt;
&lt;P&gt;Simply do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input(H,commax32.) as Value length = 8 format = 21.4&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;it is not necessary to define an informat; defined informats are only needed when reading from external data.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 08:24:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/703012#M215370</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-02T08:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Format for Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/703024#M215380</link>
      <description>I see that CommaX will work just as well as NumX. &lt;BR /&gt;&lt;BR /&gt;From the doc&lt;BR /&gt;"The COMMAX w. d informat reads numeric values and removes embedded periods, blanks, dollar signs, percent signs, hyphens, and close parentheses from the input data. The COMMAX w. d informat converts an open parenthesis at the beginning of a field to a minus sign"</description>
      <pubDate>Wed, 02 Dec 2020 08:40:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-for-Character-to-numeric/m-p/703024#M215380</guid>
      <dc:creator>DanielRingqvist</dc:creator>
      <dc:date>2020-12-02T08:40:00Z</dc:date>
    </item>
  </channel>
</rss>

