I'm a trying to use strings (which contain number) as scalar with the @val function. It works fine with string objects but does not work with string variables.
So
Code: Select all
string str = "1"
scalar i = @val(str)
works fine and i has the value 1.
But if I do
Code: Select all
%str = "1"
scalar i = @val(%str)
i takes the value NA. I guess it is not a normal behaviour as it is almost the same example as in the documentation (the only difference is that I affect the value to a scalar instead of a control variable to be able to check its value).
Do you have any idea why this occurs?
Thank you,
David