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;

 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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