@Kalai2008 wrote:
Trying to convert the Character variable to Numeric using INPUT function,but getting error NOTE: Invalid argument to function INPUT
OLD_Variable :
10202008AB_RANK00325---(Proc contents : Type: Char . Len:100 Format $100. Informat $100.
data test;
set test1;
new_var=input(old_variable, $25.);
run;
Output : new_var is still in character format.
We're all guessing here...and you still don't have an answer.
So....
Your old character variable is: OLD_Variable = '10202008AB_RANK00325---'
Post EXACTLY what you want the NEW_Variable to be. IOW, NEW_Variable = ???
Once we have your OLD_Variable ("have") and NEW_Variable ("want"), we can tell you if that is possible.
But if you think a numeric variable can contain letters, you need to hit the docs.
P.S.: Some general rules re: put/input/formats/informats:
The put function always returns character output, accepts either a numeric or character input, accepts either a numeric or character format, the type of format should match the type of input.
The input function always takes a character input, returns either a numeric or character output, accepts either a numeric or character informat, the type of informat should match the type of output.
Anything else will result in implicit type conversion or an error.
So:
new_var=input(old_variable, $25.);
has a character informat, so will return a character result.
Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.