Page 1 of 1

Use strings for scalar

Posted: Mon Mar 13, 2023 12:25 am
by dubs
Hello,

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

Re: Use strings for scalar

Posted: Mon Mar 13, 2023 8:40 am
by EViews Gareth
Should work.
2023-03-13_084040.png
2023-03-13_084040.png (36.39 KiB) Viewed 7235 times

Re: Use strings for scalar

Posted: Mon Mar 13, 2023 9:17 am
by dubs
It does not for me...
eviews.png
eviews.png (38.65 KiB) Viewed 7234 times
Could it be related to the version of Eviews (I use 12) or an option?

Re: Use strings for scalar

Posted: Mon Mar 13, 2023 9:43 am
by EViews Gareth
You need to use a program.

Re: Use strings for scalar

Posted: Tue Mar 21, 2023 3:39 am
by dubs
Thank you, indeed that makes sense