How to find out the common sample of series ?

For questions regarding programming in the EViews programming language.

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

SAMCYR
Posts: 4
Joined: Wed Jun 09, 2010 6:24 am

How to find out the common sample of series ?

Postby SAMCYR » Mon Mar 05, 2012 1:59 am

How to find out programmaticaly the common sample of series ?

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

How to find out the common sample of series ?

Postby EViews Gareth » Mon Mar 05, 2012 8:14 am

What does the "common sample of a series" mean?

SAMCYR
Posts: 4
Joined: Wed Jun 09, 2010 6:24 am

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

Postby SAMCYR » Tue Mar 06, 2012 10:40 am

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.

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

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

Postby startz » Tue Mar 06, 2012 10:46 am

To steal a line from Gareth,

Code: Select all

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

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

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

Postby EViews Gareth » Tue Mar 06, 2012 10:47 am

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))

jbourque
Posts: 7
Joined: Tue Jul 05, 2011 8:26 am
Location: Ottawa, Ontario (Canada)
Contact:

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

Postby jbourque » Tue May 22, 2012 10:14 am

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.

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

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

Postby EViews Gareth » Tue May 22, 2012 10:19 am

Code: Select all

smpl {start} @last

jbourque
Posts: 7
Joined: Tue Jul 05, 2011 8:26 am
Location: Ottawa, Ontario (Canada)
Contact:

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

Postby jbourque » Tue May 22, 2012 10:39 am

Thanks.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests