<?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 convert character to numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/convert-character-to-numeric/m-p/363252#M85974</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to convert character variables to numeric? I have data in excel like below:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;4.7479438e+01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3.4455325e+01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2.5549948e+01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2.0816337e+01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2.2582412e+01&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;my code in sas is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data new;&lt;BR /&gt;set&amp;nbsp;old;&lt;BR /&gt;numeric = input(col1,10.6);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it doesn't work. The numeric column is missing values.&lt;/P&gt;&lt;P&gt;Any idea???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;C&lt;/P&gt;</description>
    <pubDate>Wed, 31 May 2017 22:23:31 GMT</pubDate>
    <dc:creator>echoli</dc:creator>
    <dc:date>2017-05-31T22:23:31Z</dc:date>
    <item>
      <title>convert character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-character-to-numeric/m-p/363252#M85974</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to convert character variables to numeric? I have data in excel like below:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;4.7479438e+01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3.4455325e+01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2.5549948e+01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2.0816337e+01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2.2582412e+01&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;my code in sas is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data new;&lt;BR /&gt;set&amp;nbsp;old;&lt;BR /&gt;numeric = input(col1,10.6);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it doesn't work. The numeric column is missing values.&lt;/P&gt;&lt;P&gt;Any idea???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;C&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 22:23:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-character-to-numeric/m-p/363252#M85974</guid>
      <dc:creator>echoli</dc:creator>
      <dc:date>2017-05-31T22:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: convert character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-character-to-numeric/m-p/363253#M85975</link>
      <description>&lt;P&gt;It should be read by default. What's the variable type/format? When you use INPUT() try using best32. Informat.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 22:27:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-character-to-numeric/m-p/363253#M85975</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-31T22:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: convert character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-character-to-numeric/m-p/363262#M85983</link>
      <description>&lt;P&gt;The 10.6 informat is wrong. &amp;nbsp;That tells SAS to read 10 characters from your incoming character string. &amp;nbsp;Since the 10th character is a plus sign, you get missing values (along with a message in the log about invalid data). &amp;nbsp;Instead of 10.6, use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;numeric = input(col1, 13.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you actually have some longer strings in the data, you can use a wider informat. &amp;nbsp;Do not specify positions after the decimal point (such as 13.6). &amp;nbsp;Again, once you understand what that means, you'll see it can produce the wrong result.&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 22:53:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-character-to-numeric/m-p/363262#M85983</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-05-31T22:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: convert character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-character-to-numeric/m-p/363270#M85988</link>
      <description>&lt;P&gt;Hi ... it's the WIDTH that's the problem. Anyththing less than 13 will not work (COL1 has 13 characters).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If data&amp;nbsp;being read with a W.D style informat already has a decimal point, SAS will ignore the D portion of a W.D informat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;data old;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;input col1 :$13. @@;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;datalines;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;4.7479438e+01 3.4455325e+01 2.5549948e+01 2.0816337e+01 2.2582412e+01&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;data new;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;set old;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;num1 = input(col1,10.6);&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;num2 = input(col1,13.6);&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;num3 = input(col1,13.);&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;num4 = input(col1,30.6);&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;num5 = input(col1,30.);&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;DATA SET: new&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;col1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;num1 &amp;nbsp; num2 &amp;nbsp; &amp;nbsp;num3 &amp;nbsp; &amp;nbsp;num4 &amp;nbsp; &amp;nbsp;num5&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;4.7479438e+01 &amp;nbsp;. &amp;nbsp; 47.4794 47.4794 47.4794 &amp;nbsp;47.4794&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;3.4455325e+01 &amp;nbsp;. &amp;nbsp; 34.4553 34.4553 34.4553 &amp;nbsp;34.4553&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;2.5549948e+01 &amp;nbsp;. &amp;nbsp; 25.5499 25.5499&amp;nbsp;25.5499 &amp;nbsp;25.5499&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;2.0816337e+01 &amp;nbsp;. &amp;nbsp; 20.8163 20.8163 20.8163 &amp;nbsp;20.8163&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;2.2582412e+01 &amp;nbsp;. &amp;nbsp; 22.5824 22.5824 22.5824 &amp;nbsp;22.5824&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 23:26:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-character-to-numeric/m-p/363270#M85988</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2017-05-31T23:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: convert character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-character-to-numeric/m-p/363407#M86060</link>
      <description>&lt;P&gt;Try informat Ew.d&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input x e32.;
format x 32.10;
cards;
4.7479438e+01
3.4455325e+01
2.5549948e+01
2.0816337e+01
2.2582412e+01
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Jun 2017 13:00:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-character-to-numeric/m-p/363407#M86060</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-06-01T13:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: convert character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-character-to-numeric/m-p/363442#M86072</link>
      <description>&lt;P&gt;Yes, that's the point!!! it works! thanks so much!&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 14:12:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-character-to-numeric/m-p/363442#M86072</guid>
      <dc:creator>echoli</dc:creator>
      <dc:date>2017-06-01T14:12:18Z</dc:date>
    </item>
  </channel>
</rss>

