<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27639#M5087</link>
    <description>Thanks Flip.</description>
    <pubDate>Tue, 08 Dec 2009 19:46:34 GMT</pubDate>
    <dc:creator>SASPhile</dc:creator>
    <dc:date>2009-12-08T19:46:34Z</dc:date>
    <item>
      <title>Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27635#M5083</link>
      <description>How to convert the values to numeric,at times there will be a comma sometimes there will not be a comma.&lt;BR /&gt;
29,652 units&lt;BR /&gt;
60mg</description>
      <pubDate>Tue, 08 Dec 2009 17:15:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27635#M5083</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2009-12-08T17:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27636#M5084</link>
      <description>informat COMMAw. will deal with embedded commas correctly, but you might have a problem with "mg" tight against the numbers.&lt;BR /&gt;
 &lt;BR /&gt;
PeterC</description>
      <pubDate>Tue, 08 Dec 2009 18:24:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27636#M5084</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-12-08T18:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27637#M5085</link>
      <description>z = input( prxchange('s/[A-Z a-z]/ /',-1, x), comma6.);</description>
      <pubDate>Tue, 08 Dec 2009 19:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27637#M5085</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-12-08T19:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27638#M5086</link>
      <description>Thanks Peter</description>
      <pubDate>Tue, 08 Dec 2009 19:46:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27638#M5086</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2009-12-08T19:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27639#M5087</link>
      <description>Thanks Flip.</description>
      <pubDate>Tue, 08 Dec 2009 19:46:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27639#M5087</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2009-12-08T19:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27640#M5088</link>
      <description>Thanks Flip.</description>
      <pubDate>Tue, 08 Dec 2009 19:46:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27640#M5088</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2009-12-08T19:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27641#M5089</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I have the same problem. I want to convert a character-Variable into a numeric. But the tip above doesnt work correctly in my case.&lt;BR /&gt;
&lt;BR /&gt;
My data is like (character-format):&lt;BR /&gt;
&lt;BR /&gt;
0,8&lt;BR /&gt;
1,2&lt;BR /&gt;
12,3&lt;BR /&gt;
10&lt;BR /&gt;
1,2&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
after converting i want my data like (numeric-format):&lt;BR /&gt;
0.8&lt;BR /&gt;
1.2&lt;BR /&gt;
12.3&lt;BR /&gt;
10&lt;BR /&gt;
1.2&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
if i do like above i get:&lt;BR /&gt;
8&lt;BR /&gt;
12&lt;BR /&gt;
123&lt;BR /&gt;
10&lt;BR /&gt;
12&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
&lt;BR /&gt;
Any idea?&lt;BR /&gt;
&lt;BR /&gt;
Thank you in advance. Marie

Message was edited by: marieK</description>
      <pubDate>Wed, 07 Jul 2010 08:27:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27641#M5089</guid>
      <dc:creator>marieK</dc:creator>
      <dc:date>2010-07-07T08:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27642#M5090</link>
      <description>Use informat commaX.&lt;BR /&gt;
&lt;BR /&gt;
data have;&lt;BR /&gt;
input varHave $;&lt;BR /&gt;
datalines;&lt;BR /&gt;
0,8&lt;BR /&gt;
1,2&lt;BR /&gt;
12,3&lt;BR /&gt;
10&lt;BR /&gt;
1,2&lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
  set have;&lt;BR /&gt;
  varWant=input(varHave,commax8.);&lt;BR /&gt;
  put varWant=;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 07 Jul 2010 10:53:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27642#M5090</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2010-07-07T10:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27643#M5091</link>
      <description>Juhuuu &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; thanks!</description>
      <pubDate>Wed, 07 Jul 2010 11:31:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27643#M5091</guid>
      <dc:creator>marieK</dc:creator>
      <dc:date>2010-07-07T11:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27644#M5092</link>
      <description>Hi.&lt;BR /&gt;
For the first question, you can use function  translate() to convert ',' into '.',then use input() to get the numeric value.&lt;BR /&gt;
[pre]&lt;BR /&gt;
data _null_;&lt;BR /&gt;
infile datalines;&lt;BR /&gt;
input char $;&lt;BR /&gt;
num= translate(char,'.',',');&lt;BR /&gt;
put num=;&lt;BR /&gt;
datalines;&lt;BR /&gt;
0,8&lt;BR /&gt;
1,2&lt;BR /&gt;
12,3&lt;BR /&gt;
10&lt;BR /&gt;
1,2&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Note: num is also characteric value.&lt;BR /&gt;
&lt;BR /&gt;
For the second question,you can use compress() to get rid of comma.then can achieve the numeric value.&lt;BR /&gt;
[pre]&lt;BR /&gt;
data _null_;&lt;BR /&gt;
infile datalines;&lt;BR /&gt;
input char $;&lt;BR /&gt;
num= compress(char,',');&lt;BR /&gt;
put num=;&lt;BR /&gt;
datalines;&lt;BR /&gt;
0,8&lt;BR /&gt;
1,2&lt;BR /&gt;
12,3&lt;BR /&gt;
10&lt;BR /&gt;
1,2&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Note: num is also characteric value.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Wed, 07 Jul 2010 12:47:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27644#M5092</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-07-07T12:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27645#M5093</link>
      <description>Thank you! The translate-function is good &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Thu, 08 Jul 2010 09:52:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-numeric/m-p/27645#M5093</guid>
      <dc:creator>marieK</dc:creator>
      <dc:date>2010-07-08T09:52:28Z</dc:date>
    </item>
  </channel>
</rss>

