BookmarkSubscribeRSS Feed
mamin088
Fluorite | Level 6

Hello,

 

I'm trying to convert character values of a variable to numeric using the below code:

 

data my_new;

set  my _old;

new_var=input (old_var,8.);

run;

 But I get this note in the log: numeric values have been converted to character values at the places given by :

(line):(column).

100:22    100:29

 

I don't understand why. The column for my variable of interest is column 2.

Every time I run the code I'll get the same SAS note for different line and column.

 

Would somebody helps me with this please ? Thanks!

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

As the Input Function Documentation says, the Input Function requires a character constant, variable, or expression. SAS issues this note if the argument is numeric.

mamin088
Fluorite | Level 6

I solved the problem! Actually what I was doing was to convert the values but keep the same variable (name). I was doing this:

 

data my_new;

set  my _old;

var=input (var,8.)

run;

 

Then I was getting that note. I tried this code and it worked perfectly:

 

data my_new;

set  my _old;

new_var=input (old_var,8.);

drop old_var;

rename new_var=old_var;

run;

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 665 views
  • 1 like
  • 2 in conversation