<?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 Changing character values to numeric values in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Changing-character-values-to-numeric-values/m-p/306443#M8761</link>
    <description>&lt;P&gt;I have a SAS dataset with a variable called LENGTH, which describe the length of a fishing line. &amp;nbsp;But some of the values have a ',' instead of a '.' to designate a decimal point, so SAS read this variable as a character variable. &amp;nbsp;How do I replace all ',' with '.' and convert the variable to numeric?&lt;/P&gt;</description>
    <pubDate>Fri, 21 Oct 2016 20:39:03 GMT</pubDate>
    <dc:creator>RandiRyterman</dc:creator>
    <dc:date>2016-10-21T20:39:03Z</dc:date>
    <item>
      <title>Changing character values to numeric values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Changing-character-values-to-numeric-values/m-p/306443#M8761</link>
      <description>&lt;P&gt;I have a SAS dataset with a variable called LENGTH, which describe the length of a fishing line. &amp;nbsp;But some of the values have a ',' instead of a '.' to designate a decimal point, so SAS read this variable as a character variable. &amp;nbsp;How do I replace all ',' with '.' and convert the variable to numeric?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 20:39:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Changing-character-values-to-numeric-values/m-p/306443#M8761</guid>
      <dc:creator>RandiRyterman</dc:creator>
      <dc:date>2016-10-21T20:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: Changing character values to numeric values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Changing-character-values-to-numeric-values/m-p/306446#M8762</link>
      <description>&lt;P&gt;Use TRANSLATE to replace the commas with periods.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var_char = translate(var_char, ".", ",");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;USE INPUT to convert character to numeric&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Var_Num = input(var_char, best12.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Oct 2016 20:47:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Changing-character-values-to-numeric-values/m-p/306446#M8762</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-21T20:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Changing character values to numeric values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Changing-character-values-to-numeric-values/m-p/306490#M8769</link>
      <description>&lt;P&gt;Canyou post some data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Var_Num = input(var_char, ??  best12.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 22 Oct 2016 02:21:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Changing-character-values-to-numeric-values/m-p/306490#M8769</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-10-22T02:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Changing character values to numeric values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Changing-character-values-to-numeric-values/m-p/306491#M8770</link>
      <description>&lt;P&gt;If you're reading the data from a text file then you could also do something like below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  invalue mixedComma
    low-high = [comma.]
    other    = [commax.]
  ;
quit;

data test;
  infile datalines dsd dlm=' ' truncover;
  input var :mixedComma.;
  datalines;
10.2
10,2
10
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 22 Oct 2016 02:38:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Changing-character-values-to-numeric-values/m-p/306491#M8770</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2016-10-22T02:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Changing character values to numeric values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Changing-character-values-to-numeric-values/m-p/306495#M8772</link>
      <description>&lt;P&gt;Patrick,&lt;/P&gt;
&lt;P&gt;I would do this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  infile datalines dsd dlm=' ' truncover;
  input var $;
  if find(var,',') then fmt='commax32.';
   else fmt='best32.    ';
  new=inputn(var,fmt);
  datalines;
10.2
10,2
10
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 22 Oct 2016 03:00:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Changing-character-values-to-numeric-values/m-p/306495#M8772</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-10-22T03:00:39Z</dc:date>
    </item>
  </channel>
</rss>

