Reverse @elem(series, date)

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

fmgoto
Posts: 76
Joined: Thu Jan 15, 2009 5:01 am
Location: Brasilia, Brazil

Reverse @elem(series, date)

Postby fmgoto » Mon May 17, 2010 2:14 pm

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!

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Reverse @elem(series, date)

Postby EViews Gareth » Mon May 17, 2010 2:30 pm

Maybe I'm missing something, but don't you just mean:

Code: Select all

smpl 2010m5 2010m5 y = ysa smpl @all

fmgoto
Posts: 76
Joined: Thu Jan 15, 2009 5:01 am
Location: Brasilia, Brazil

Re: Reverse @elem(series, date)

Postby fmgoto » Tue May 18, 2010 7:32 am

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!

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Reverse @elem(series, date)

Postby EViews Gareth » Tue May 18, 2010 8:19 am

I'm still not clear on why my above solution doesn't do what you want.

fmgoto
Posts: 76
Joined: Thu Jan 15, 2009 5:01 am
Location: Brasilia, Brazil

Re: Reverse @elem(series, date)

Postby fmgoto » Tue May 18, 2010 10:12 am

Because I may need lags and leads, such as y(2010m01) = y_sa(2010m03). Thanks.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Reverse @elem(series, date)

Postby EViews Gareth » Tue May 18, 2010 10:39 am

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

fmgoto
Posts: 76
Joined: Thu Jan 15, 2009 5:01 am
Location: Brasilia, Brazil

Re: Reverse @elem(series, date)

Postby fmgoto » Tue May 18, 2010 11:00 am

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!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests