Setting sample range

For questions regarding programming in the EViews programming language.

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

trainee
Posts: 38
Joined: Fri Jun 13, 2014 12:59 pm

Setting sample range

Postby trainee » Tue Apr 04, 2017 1:08 pm

Hi,

I want to set my sample range such that my sample end is set to the date that corresponds to the the latest value of my longest series. What code could I use to achieve this?

Here is some detail on what I'm trying to do:

I'm trying to aggregate country level data to arrive at regional aggregate. Due to non-synchronicity of data releases, some country series are missing data for recent months. If I just straight aggregate them I would be throwing away country level data that is available. Hence, I've decided to fill the missing data using foretasted values before I aggregate. However, I want the forecast for the missing data to extend only as long as the longest series. Therefore, I'm trying to set the end of my forecast sample to the latest date where realized number is available for the most up to date series.

Not sure if that was clear but any help would be greatly appreciated.

Thanks so much!

EViews Matt
EViews Developer
Posts: 563
Joined: Thu Apr 25, 2013 7:48 pm

Re: Setting sample range

Postby EViews Matt » Tue Apr 04, 2017 1:44 pm

Hello,

It sounds like you want to determine the date of the last observation with at least one non-missing value among a collection of series. Given a group containing all the series you're interested in (named all below), the follow program demonstrates how you could determine the sample end date.

Code: Select all

series tmp = @recode(@robs(all) > 0, @trend, 0)
%mylast = @otod(@max(tmp) + 1)
smpl @first %mylast


Return to “Programming”

Who is online

Users browsing this forum: Google [Bot] and 24 guests