Page 1 of 1

How to find out the common sample of series ?

Posted: Mon Mar 05, 2012 1:59 am
by SAMCYR
How to find out programmaticaly the common sample of series ?

How to find out the common sample of series ?

Posted: Mon Mar 05, 2012 8:14 am
by EViews Gareth
What does the "common sample of a series" mean?

Re: How to find out the common sample of series ?

Posted: Tue Mar 06, 2012 10:40 am
by SAMCYR
The common sample of series in a workfile. For instance, in our workfile we have :

- Serie S1 which contains non-missing values from 1990Q1 to 2010Q2
- Serie S2 which contains non-missing values from 1998Q1 to 2010Q2
- Serie S3 which contains non-missing values from 2000Q1 to 2011Q4

The common sample would be in that case the period where all those 3 series have non-missing values : 2000Q1 to 2010Q2

Then we would like to find out how to identify the common sample like when you use groups to generates statistics for the group with the option to select common sample.

Re: How to find out the common sample of series ?

Posted: Tue Mar 06, 2012 10:46 am
by startz
To steal a line from Gareth,

Code: Select all

smpl if s1<>na and s2<>na and s3<>na

Re: How to find out the common sample of series ?

Posted: Tue Mar 06, 2012 10:47 am
by EViews Gareth
I guess it depends on what you plan to do with that information. The basic information can be got by by putting them into a group (say G) and doing the following:

Code: Select all

series common = @robs(G)=G.@count
which will create a dummy variable, called common, containing a 1 if that observation is available for all series in the group, and a zero other wise.

If you just want to set the sample you can do:

Code: Select all

smpl if @robs(G) = G.@count
Getting actual dates is considerably more complicated if there are internal NAs. If there are no internal NAs, then you can get the start date and end date with:

Code: Select all

smpl if @robs(G) = G.@count series common = 1 smpl @all string start = @otod(@ifirst(common)) string end = @otod(@ilast(common))

Re: How to find out the common sample of series ?

Posted: Tue May 22, 2012 10:14 am
by jbourque
Hi,
Thanks all for this information. I am a bit puzzled however as to how to use the "start" and "end" strings within a smpl command. All of the following returned an "Error in sample. Illegal date" message. My workfile uses annual data by the way.

smpl start @last
smpl @val(start) @last
smpl @year(start) @last
smpl @dateval(start, "yyyy") @last
smpl @year(@val(start)) @last

Any help would be greatly appreciated.

Re: How to find out the common sample of series ?

Posted: Tue May 22, 2012 10:19 am
by EViews Gareth

Code: Select all

smpl {start} @last

Re: How to find out the common sample of series ?

Posted: Tue May 22, 2012 10:39 am
by jbourque
Thanks.