Page 1 of 1

Merging series

Posted: Wed Apr 22, 2009 6:47 am
by javiersan
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

Re: Merging series

Posted: Wed Apr 22, 2009 7:10 am
by startz
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

Re: Merging series

Posted: Wed Apr 22, 2009 2:21 pm
by javiersan
Thanks Startz.

Regards,

Javier

Re: Merging series

Posted: Wed Apr 22, 2009 2:53 pm
by EViews Glenn
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.

Re: Merging series

Posted: Thu Apr 23, 2009 9:14 am
by javiersan
Thanks, that's much neater.

Regards,

Javier