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!
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.
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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.