Merging series

For questions regarding programming in the EViews programming language.

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

javiersan
Posts: 184
Joined: Mon Jan 19, 2009 8:18 am

Merging series

Postby javiersan » Wed Apr 22, 2009 6:47 am

Hello,

I'd like to know if you have any idea that is easy to implement in order to merge series. Say I have 2 series with annual frequency, Series 1 runs from 1970 to 2004 and Series 2 runs from 2000 to 2008.

I would like then to write some code to combine these into Series 3 which will have data from Series 1 from 1970-1999 and from Series 2 from 2000-2008.

Any suggestions welcome.

Thanks,

Javier

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Merging series

Postby startz » Wed Apr 22, 2009 7:10 am

javiersan wrote:Hello,

I'd like to know if you have any idea that is easy to implement in order to merge series. Say I have 2 series with annual frequency, Series 1 runs from 1970 to 2004 and Series 2 runs from 2000 to 2008.

I would like then to write some code to combine these into Series 3 which will have data from Series 1 from 1970-1999 and from Series 2 from 2000-2008.

Any suggestions welcome.

Thanks,

Javier

Code: Select all

smpl 1970 1999
series s3=s1
smpl 2000 2008
s3 = s2
smpl @all

javiersan
Posts: 184
Joined: Mon Jan 19, 2009 8:18 am

Re: Merging series

Postby javiersan » Wed Apr 22, 2009 2:21 pm

Thanks Startz.

Regards,

Javier

EViews Glenn
EViews Developer
Posts: 2672
Joined: Wed Oct 15, 2008 9:17 am

Re: Merging series

Postby EViews Glenn » Wed Apr 22, 2009 2:53 pm

Startz's answer is a good one. Here are a couple of alternatives that illustrate the use of other EViews tools:

Code: Select all

series s3 = @recode(@year<=1999, s1, s2)

or

Code: Select all

series s3 = (@year<=1999)*s1 + (@year>1999)*s2

The first approach is more efficient than the second.

javiersan
Posts: 184
Joined: Mon Jan 19, 2009 8:18 am

Re: Merging series

Postby javiersan » Thu Apr 23, 2009 9:14 am

Thanks, that's much neater.

Regards,

Javier


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 55 guests