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!
The line numbers refer to the numbers in the log.
CHECK YOUR LOG. And post it.
The line numbers refer to the numbers in the log.
CHECK YOUR LOG. And post it.
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):
In your code snippet:
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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.