Page 1 of 1

mistery in @elem function

Posted: Wed Dec 07, 2011 8:57 am
by Novi
Hi Eviews users,
I am very puzzled by a strange results eviews 6 gives me: I want to access element "@first+t" (where t is a predefined scalar) of series x...

the same command :

scalar pr=@elem(x,"@first+t")

will give the right result in one workfile, and 0 in the other workfile, even if in both files the series x has no Na and obviously it has a finite value for the obsrvervation @first+t....is my syntax wrong in any way? can this be a bug?
If any of u has any idea of what's going on please let me know...

Re: mistery in @elem function

Posted: Wed Dec 07, 2011 9:09 am
by EViews Gareth

Code: Select all

scalar pr=@elem(x,"@first+t")
isn't proper syntax for the @elem command. Possibly what you want to do is:

Code: Select all

%date = @otod(t+1) scalar pr = @elem(x, %date)

Re: mistery in @elem function

Posted: Wed Dec 07, 2011 9:11 am
by EViews Gareth
I should also note that you can actually do:

Code: Select all

scalar pr = x(t+1)
although I don't recommend this, since it is confusing when using it with:

Code: Select all

series pr = x(t+1)
since the first example access the t+1th element of X, the second example access the t+1th lead of X, and it can be confusing to figure out which one you're doing.

Re: mistery in @elem function

Posted: Wed Dec 07, 2011 9:14 am
by Novi
Thanks!
I had the feeling that I was missing something stupid... :D