What does w{%A}(!i+1) mean in EViews?

581 Views Asked by At

Couldn't find any hint about w{} on eviews documents. Any explanation?

w{}(), can't understand how it works.

BTW, how can I print a single variable to command window not print it to a file?

Thanks!

2

There are 2 best solutions below

0
On

{} can change a variables value (in programming not series) to string. For example if there is WTR, WCR, KJ and Y series in our file, following command would be run.

%A = "TR"
!i=2
ls Y c W{%A}(!i+1)

Means ls Y c WTR(3) and also

%A = "TR"
%B= "CR"
%F="KJ"
!i=3
!k=-1
 ls Y c W{%A}(!i+1) W{%B}(!k-3)  {%F} 

Means ls Y c WTR(4) WCR(-4) KJ

0
On

Curly braces in EViews work the way that statements like eval() perform in other programming languages. They tell EViews "strip quotes off of this string and evaluate it as valid EViews code".

%A is a "program string", a temporary string variable only used when executing an EViews program. !i is a "program scalar", a temporary scalar variable only used when executing an EViews program.

It's hard to answer your question without knowing what type of object W{%A} is supposed to be. But if %A holds a value like USA, for example, W{%A} will look for an object in your workfile called WUSA. If !i holds the value 1, for example, W{%A}(!i+1) is equivalent to WUSA(2). This could, for example, be an attempt to grab a particular element of a vector object.