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
Generating new series
Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13318
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Generating new series
Code: Select all
series delta = @recode(alpha<>na, alpha, @recode(bravo<>na, bravo, charlie))
Follow us on Twitter @IHSEViews
-
- Posts: 4
- Joined: Thu Aug 03, 2017 4:01 am
Re: Generating new series
Duh! Thanks, much appreciated!
Who is online
Users browsing this forum: No registered users and 40 guests