<?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: Turn Character to numaric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Turn-Character-to-numaric/m-p/396591#M95773</link>
    <description>&lt;P&gt;What is your HAVE data set?&lt;/P&gt;</description>
    <pubDate>Sat, 16 Sep 2017 21:52:40 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-09-16T21:52:40Z</dc:date>
    <item>
      <title>Turn Character to numaric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Turn-Character-to-numaric/m-p/396590#M95772</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know it is not new but I am so curious how SAS handle the following problem&lt;/P&gt;
&lt;P&gt;I try different way and I find that it work when I create new variable to replace the old one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone help me to explain why some methods (documented below works) while some don't?&lt;/P&gt;
&lt;P&gt;Is there any way where I can simply tell SAS to change the format?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HC&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input total $7.;
datalines;
12.51
12309.51
;run;

data want; set have;
*no work;
total=total+0;	
total=input(total,best12.);
total=input(total,COMMA8.2);

*works;
total_num1=total+0;
total_num2=input(total,best12.);
total_num3=input(total,8.2);
total_num4=input(total,COMMA12.);
total_num5=input(total,COMMA8.2);

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 23:52:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Turn-Character-to-numaric/m-p/396590#M95772</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-09-16T23:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: Turn Character to numaric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Turn-Character-to-numaric/m-p/396591#M95773</link>
      <description>&lt;P&gt;What is your HAVE data set?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 21:52:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Turn-Character-to-numaric/m-p/396591#M95773</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-16T21:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Turn Character to numaric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Turn-Character-to-numaric/m-p/396593#M95774</link>
      <description>&lt;P&gt;A SAS variable&amp;nbsp;type cannot change, ie character to numeric with the same name is not possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can create a new variable with a numeric format, ergo the last examples work. You can mimic what you want by renaming the variable on your SET statement or providing a new name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 21:55:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Turn-Character-to-numaric/m-p/396593#M95774</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-16T21:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: Turn Character to numaric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Turn-Character-to-numaric/m-p/396603#M95776</link>
      <description>&lt;P&gt;oh,&lt;/P&gt;
&lt;P&gt;here it is.&lt;/P&gt;
&lt;P&gt;HC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input total $7.;
datalines;
12.51
12309.51
;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 16 Sep 2017 23:51:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Turn-Character-to-numaric/m-p/396603#M95776</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-09-16T23:51:01Z</dc:date>
    </item>
  </channel>
</rss>

