I want to convert x to numeric.
DATA test; input x $1.; cards; 1 2 0 ; run;
I tried different ways:
The following note is printed in the journal:
NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column). 2470:3 NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 2470:4
And the format does not change.
The following note is printed in the journal:
NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 2396:3
And the format does not change.
The following error is printed in the log:
ERROR 48-59: The informat $BEST was not found or could not be loaded.
What is explained here and here : the compiler detects different types of variables and format, makes a mistake, adds the alleged missing $ and therefore does not find the format.
All these tests will work if I created a second variable, for example, for example:
DATA test4; SET test (rename=(x=x2)); x = x2*1; drop x2; run;
But I'm trying to clear my code, and I wonder if there is a way to do such a conversion without this?
type-conversion sas
Vincent
source share