Page 1 of 1
Reverse @elem(series, date)
Posted: Mon May 17, 2010 2:14 pm
by fmgoto
Sorry to bother again, but how do I get the i-th element from a date series without fixing? I need to get a given element of a series and paste it at a given element of another series.
Code: Select all
series y = something
series y_sa = another_thing
y("2010m05") = @elem(y_sa, "2010m05")
But the thing is that I cannot erase the past or future in y.
Any thoughts? Thanks!
Re: Reverse @elem(series, date)
Posted: Mon May 17, 2010 2:30 pm
by EViews Gareth
Maybe I'm missing something, but don't you just mean:
Code: Select all
smpl 2010m5 2010m5
y = ysa
smpl @all
Re: Reverse @elem(series, date)
Posted: Tue May 18, 2010 7:32 am
by fmgoto
Sorry I did not make myself clear.
I need to add iteratively only the last element to the y series from the y_sa, preserving the previous ones in y.
The solution I have reached so far is to define i = 2010m05 and set y(i) = @elem(y_sa, "2010m05"). I wonder if Eviews would understand y(2010m05) = @elem(y_sa, "2010m05"), instead of i = 2010m05 + y(i) =@elem(y_sa, "2010m05").
Thanks!
Re: Reverse @elem(series, date)
Posted: Tue May 18, 2010 8:19 am
by EViews Gareth
I'm still not clear on why my above solution doesn't do what you want.
Re: Reverse @elem(series, date)
Posted: Tue May 18, 2010 10:12 am
by fmgoto
Because I may need lags and leads, such as y(2010m01) = y_sa(2010m03). Thanks.
Re: Reverse @elem(series, date)
Posted: Tue May 18, 2010 10:39 am
by EViews Gareth
The easiest way to do that is still with samples:
Code: Select all
smpl 2010m1 2010m1
y = y_sa(2)
smpl @all
or (not sure if this works, but should):
Code: Select all
smpl 2010m1 2010m1
y = @elem(y_sa,"2010m03")
smpl @all
If that doesn't work, you can break it up into two steps:
Code: Select all
smpl 2010m1 2010m1
!val = @elem(y_sa,"2010m03")
y = !val
smpl @all
Re: Reverse @elem(series, date)
Posted: Tue May 18, 2010 11:00 am
by fmgoto
That last code is great! Didnt think of that. Plain and simple.
The problem here was that there is no mapping from the string "2010m05" to the "i"-th observation of a y series!
Thanks a lot!