Generating new series

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

destofante
Posts: 4
Joined: Thu Aug 03, 2017 4:01 am

Generating new series

Postby destofante » Thu Aug 03, 2017 8:05 am

Hello,

Bear with me, I am just a beginner... I am struggling with a problem which should be rather elementary, but I am still a bit out of my (shallow) depth here.

I have three monthly time series: Alpha Bravo Charlie.

I want to generate a new series, Delta, such that, for each observation,

If series Alpha includes a value (as opposed to be NA), the observation in Delta will be set equal to the value in Alpha;
If Alpha is NA but Bravo includes a value, the observation in Delta will be set equal to the value in Bravo;
If Alpha and Bravo are both NA, it will be set equal to the one in Charlie.

(Alpha in a series with actual historical values; Bravo includes short-term forecasts from a more reliable model, and Charlie includes long-term forecasts from a less reliable model with a longer horizon. Delta will, in turn, be the input to a different forecasting exercise.)

I am not sure what is the best way to tackle the problem: working with shifting smpl timeframes, or a creating a loop based on a sequence of IF and ELSE commands? In both cases, I am rather clueless. I expect at one point the command "series Delta = something" will show up, but how to get there?

Thanks in advance for any tip!

DF

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

Re: Generating new series

Postby EViews Gareth » Thu Aug 03, 2017 8:29 am

Code: Select all

series delta = @recode(alpha<>na, alpha, @recode(bravo<>na, bravo, charlie))
Follow us on Twitter @IHSEViews

destofante
Posts: 4
Joined: Thu Aug 03, 2017 4:01 am

Re: Generating new series

Postby destofante » Fri Aug 04, 2017 5:11 am

Duh! Thanks, much appreciated!


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 22 guests