11-22-2016 03:06 PM
I am attempting to get rid of a NOTE in the log file. (v9.4, Windows)
I run the following code:
data _temp; a=1; output; run; data _temp2; set _temp; b = input(a, best12.); run;
In the log, there is this NOTE:
NOTE: Numeric values have been converted to character values at the places given by:
Both variables a and b are numeric, and best12. is numeric informat. Why is the input function converting numeric values to character values?
Is there another function I should use to get rid of the NOTE in the log?
11-22-2016 03:12 PM
Because input() is designed to input from strings, the numeric value in a must first be converted to character, so it can be read with the best12. informat.
11-22-2016 03:18 PM
INPUT() function is used to convert character to numeric. In your example INPUT(a,best12.) --> Here 'a' must be given character values. Since you gave numeric value it converted to character and again ti numeric.
11-22-2016 03:32 PM
I am trying to use informats for data validation.
For example, the external data is expected to have three values 0, 1, and 99 to indicate unknown. I want to return a variable with just 0 and 1, convert the 99 to missing and throw an error when other values are encountered.
data _externalData; a=1; output; a=0; output; a=77; output; a=99; output; run; proc format; invalue test 0-1 = _same_ 99 = . other = _error_ ; run; data _myData; set _externalData; b = input(a, test.); run;
The results are what I desire, I just want to get rid of the (seemingly) unnecessary NOTE in the log. Should I be using another function besides input?
11-22-2016 03:37 PM
11-22-2016 03:54 PM
0 = 0
1 = 1
99 = .
b = put(a, test.);