Page 1 of 1

Complete timeseries in group only

Posted: Wed Aug 01, 2012 4:08 am
by fboehlandt
Hi everyone,

I have a workfile with several timeseries of various lengths. For example, one series could have entries from 2000/07 to 2010/06, another from 1995/07 to 2005/06 and so on. I would like to create groups including timeseries with entries between two specific dates. Timeseries with fewer observations should be excluded. None of the series have any gaps.

Setting the sample to a specific start and end date does not help either, since timeseries with fewer observations are still included.

Can anyone help? A code implementation would be appreciated unless there is a way to do this using sampling

Complete timeseries in group only

Posted: Wed Aug 01, 2012 4:40 am
by EViews Gareth
I think I would add every series to a group then loop through the members one at a time and check the number of obs. If too few, drop that series.

Re: Complete timeseries in group only

Posted: Wed Aug 01, 2012 5:51 am
by fboehlandt
Hello Gareth,
thanks for your reply. I got something like this

Code: Select all

%strg = "cfp01" !m = {%strg}.@count for !i = 1 to !m %n={%strg}.@seriesname(!i) !n = {%n}.@obs if !n < 60 then {%strg}.drop {%n} endif next
However, problem is that the number of series within the group changes dynamically (series being dropped). I need something like a do...while statement

Re: Complete timeseries in group only

Posted: Wed Aug 01, 2012 6:03 am
by fboehlandt
never mind, I can do it using two groups
%str1 = "cfp01"
%str2 = "cfp02"
group {%str2}
!m = {%str1}.@count
for !i = 1 to !m
%n={%str1}.@seriesname(!i)
!n = {%n}.@obs
if !n >= 60 then
{%str2}.add {%n}
endif
next
I suppose thats the easiest way of going about it. Thanks again
cheers