Counting dates between observations

For questions regarding programming in the EViews programming language.

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

mikela
Posts: 14
Joined: Tue Jan 11, 2011 8:24 am

Counting dates between observations

Postby mikela » Tue Jan 18, 2011 6:07 am

Hi everyone,
I have a simple but tedious problem to solve and i am starting to feel desperate...

I have lots of times series (annual data from 1900-2011) with lots of #NAs in them. What i need to do is to produce a table with the number of years between observations.
Is there an easy way to do this in eviews? I was thinking about @datediff but, for a start, I don't know how to pick the date value (for the existing observations)!

Any help is very much appreciated,
thanks
Mikela

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

Re: Counting dates between observations

Postby EViews Gareth » Tue Jan 18, 2011 8:59 am

Something like this:

Code: Select all

smpl @first @first series count=x=na smpl @first+1 @last count = @recode(x=na, count(-1)+1,0)

mikela
Posts: 14
Joined: Tue Jan 11, 2011 8:24 am

Re: Counting dates between observations

Postby mikela » Wed Jan 19, 2011 2:07 am

thanks! i was struggling with cumsum (because it continue to cumulate regardless of the missing values) but with this code was much easier, thanks again!

Jen
Posts: 3
Joined: Sat Jan 29, 2011 5:14 am

Re: Counting dates between observations

Postby Jen » Mon Jan 31, 2011 6:39 am

Hi,

I have time series data for 2001, 2003, 2005, and 2007, which workfile structure type do I select?

I have selected unstructured/undated but it does not seem to be working.

What is the minimum number of observations needed for time series data?

Many Thanks,
Jen

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

Re: Counting dates between observations

Postby EViews Gareth » Mon Jan 31, 2011 9:00 am

Dated - regular frequency

Frequency - Multi-year (2 year)

Start date: 2001
End date: 2007

Jen
Posts: 3
Joined: Sat Jan 29, 2011 5:14 am

Re: Counting dates between observations

Postby Jen » Mon Jan 31, 2011 1:21 pm

Thanks Gareth that really helps.

Do you have to have data at regular intervals, for example could i have 2001, 2003, 2005, 2006, 2007, 2008?

Also what is the minimum number of observations required to run White Heteroskedacity cross terms test?

Many Thanks
Jen

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

Re: Counting dates between observations

Postby EViews Gareth » Mon Jan 31, 2011 2:39 pm

If you want irregularly spaced data, you'll have to create an irregular workfile. You'll have to consult the documentation for more information.


There is never a correct answer to the "how many observations do I need" question.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests