Page 1 of 1

Flow control with string variables

Posted: Thu May 12, 2016 11:24 am
by londonphd
Hello,

Transition from R to Eviews programming has been a little painful, hope someone will help with the following question:

Code: Select all

string xd=deter(!i) if %xd="trend" then %xd="d" else %xd="b" endif
here deter is a "string vector", its elements are either "trend" or "cons". I ran the code and it appeared to work, but then the results did not appear to be right.

Thank you.

Re: Flow control with string variables

Posted: Thu May 12, 2016 12:03 pm
by EViews Gareth
Well, XD and %XD are different things. It looks like you're assigning to XD, but testing %XD.

Re: Flow control with string variables

Posted: Thu May 12, 2016 12:38 pm
by londonphd
Well, XD and %XD are different things. It looks like you're assigning to XD, but testing %XD.
Thanks Gareth, I corrected it, works flawlessly. I was following an example where "%" is used, just did not read the details properly.