## identify which observation has a character value and generating conversion note

Solved
Regular Contributor
Posts: 187

# identify which observation has a character value and generating conversion note

[ Edited ]

Hi,

I am doing a char to numeric conversion, but I am getting one note in my log that says:

NOTE: Character values have been converted to numeric values at the places given by: (Line)Column).
6232:23

I don't have this many lines or columns in my data set.  I also don't see any character values that would generate this note.  I did a proc freq on all the variables I am converting.  Is there any way to specifically identify which value this is pointing to?  I have no idea what the 6232:23 is (i have 3504 rows and 14 columns).  I know it's not a big deal, but I can't have any conversion notes in my log.

Here is some of code:

length results \$100.;
format range \$4.;
siresult1=input(siresult,best.);
SINORMLO1=input(SINORMLO,best.);
SINORMHI1=input(SINORMHI,best.);
if siresult1^=. then do;
if siresult1< SINORMLO1 then Range='L';
if siresult1>SINORMHI1 then Range='H';
if SINORMLO1<SIRESULT1<SINORMHI1 then Range='';
results=catx(", ",put(siresult1,8.1), range);
end;
else if siresult1='' then do;
results='';

Thank you!

Accepted Solutions
Solution
‎11-16-2017 06:27 PM
Super User
Posts: 24,004

## Re: identify which observation has a character value and generating conversion note

The line numbers refer to the numbers in the log.

CHECK YOUR LOG. And post it.

All Replies
Solution
‎11-16-2017 06:27 PM
Super User
Posts: 24,004

## Re: identify which observation has a character value and generating conversion note

The line numbers refer to the numbers in the log.

CHECK YOUR LOG. And post it.

Regular Contributor
Posts: 187

## Re: identify which observation has a character value and generating conversion note

Found it! Thank you.
Super User
Posts: 2,512

## Re: identify which observation has a character value and generating conversion note

The numbers are the position in the log.

Here line #27 column # 5.

25
26 data T;
27 A='1'+1;
28 run;

NOTE: Character values have been converted to numeric values at the places given by: (Line)Column).
27:5
NOTE: The data set WORK.T has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):

Super User
Posts: 13,941

## Re: identify which observation has a character value and generating conversion note

```if siresult1^=. then do;  <= siresult is numeric
if siresult1< SINORMLO1 then Range='L';
if siresult1>SINORMHI1 then Range='H';
if SINORMLO1<SIRESULT1<SINORMHI1 then Range='';
results=catx(", ",put(siresult1,8.1), range);
end;
else if siresult1='' then do;  <= here you are treating siresult as character```

Us the function MISSING:

else if missing(siresult) then do ...

OR compare to the missing value

else if sirresult = . then do

Use of missing is a better option as that is one of the functions that works with both numeric and character values. Also it makes the code a bit easier to understand.

☑ This topic is solved.