Hi
I would like to use monthly data in a quarterly page. For quarters where all 3 months are available the simple average across monthly values option is fine, but I don't want to waste any available months past the last full quarter.
How can I use monthly series in a quarterly page so that the months are average except when there are only 1 or 2 months in the last quarter, in which case I would want to repeat the last available month for the empty months in that quarter and only then average the 3 months.
Thanks!
Monthly data by quarter
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13305
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Monthly data by quarter
I think the easiest way would be on the monthly page to create a new series that is equal to the original series, but fills in the missing months with the previous month's value.
If it is always only the last month of a quarter that is missing something as simple as:
would do the trick (assuming the very first observations is not an NA).
If it is always only the last month of a quarter that is missing something as simple as:
Code: Select all
series x = @recode(y=na, x(-1), y)
would do the trick (assuming the very first observations is not an NA).
Follow us on Twitter @IHSEViews
-
- EViews Developer
- Posts: 560
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Monthly data by quarter
If your monthly data doesn't fall on quarter boundaries, or you don't want to extend it so that Gareth's solution could be applied, you could also explicitly "clean up" the last observation of the quarterly data. For example, for a fictitious series x on two pages "Monthly" and "Quarterly":
Code: Select all
pageselect Monthly
if @mod(@datepart(@dateval(x.@last), "mm"), 3) = 2 then
smpl @last-1 @last
!avg = (@first(x) + 2 * @last(x)) / 3
pageselect Quarterly
smpl @last @last
x = !avg
endif
Last edited by EViews Matt on Wed Apr 12, 2017 8:48 am, edited 1 time in total.
-
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
Re: Monthly data by quarter
series x = @recode(y=na, x(-1), y)
I think I did this wrong because only 1 NA gets filled or the whole series is NA. So x is the old series and y is the new series?
-
- EViews Developer
- Posts: 560
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Monthly data by quarter
The reverse, x is the new series and y is the old series.
-
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
Re: Monthly data by quarter
ah, of course. thanks!
Who is online
Users browsing this forum: No registered users and 21 guests