DATA Step, Macro, Functions and more

Convert character varaible to numeric

Reply
SAS Employee
Posts: 105

Convert character varaible to numeric

Hi,
Let say I have:

data test;
w="8,5";
run;

I want to convert the variable w to numeric but to numeric with period and not with comma .
the result should be 8.5.
I wanted to do it only with input function (not to use scan/translate function before).
Is there a way to do it (a appropriate format)?

Thanks in advance
SAS Super FREQ
Posts: 8,868

Re: Convert character varaible to numeric

Hi:
Check out the COMMAX informat for use with the INPUT function:
http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000204406.htm

cynthia
SAS Employee
Posts: 105

Re: Convert character varaible to numeric

Hi Cynthia,
Thanks alot!
Ask a Question
Discussion stats
  • 2 replies
  • 152 views
  • 0 likes
  • 2 in conversation