Page 1 of 1

Continuous Observations - Panel Data

Posted: Wed Aug 19, 2009 3:39 am
by J.Kratochvil-08
To whom it may concern,

I would like to enquire how could I obtain an unbalanced panel of data with at least X (e.g. 5) continuous observations on each group?

To be more precise, I have a panel of 17000 firms with data on 10 variables (dividends, cash flow, etc) for a period of 11 years. I have already manipulated the data in Excel so I have only firms that have complete records on all variables of interest. I also need to impose a restriction that firms with less than 5 years of continuous observations are dropped from my sample. Is there any way I could achieve this using EViews?

Thank you very much for your valued time and I look forward to hearing from you.

Yours sincerely,

J Kratochvil

Re: Continuous Observations - Panel Data

Posted: Wed Aug 19, 2009 8:03 am
by EViews Gareth
Tricky, but possible.

Create a series that is equal to a moving observation count. Then create a series that is equal to the maximum moving observation count, by cross-section. Then set the sample so that any cross-section whose maximum moving observation count is greater than, or equal to, 5 is included.

Or, in one line:
smpl if @maxsby(@movobs(x,5),@crossid)>=5

where X is one of your series.

Re: Continuous Observations - Panel Data

Posted: Mon Nov 28, 2011 6:37 am
by Amber
Dear Gareth,

I have a similar problem, I also have an unbalanced pool containing 800 firms. I need to extract the firms having obs more than 60 and put them in a new workfile. I am stuck in the programing, will you please help me out?

Thanks so much.

Amber

Re: Continuous Observations - Panel Data

Posted: Mon Nov 28, 2011 8:48 am
by EViews Gareth
Are you in a pool or in a panel? (panel is much much easier).

Re: Continuous Observations - Panel Data

Posted: Mon Nov 28, 2011 10:23 am
by Amber
Dear Gareth, I can re-structure them in a panel. So panel.
Again I really appreciate your time.

Re: Continuous Observations - Panel Data

Posted: Mon Nov 28, 2011 10:28 am
by EViews Gareth
From a panel, the easiest thing to do make a copy of the current page (easiest way is to drag the page icon at the bottom of the workfile to the right until you get the little "+" symbol, or use the pagecopy command). Then make a series that contains the number of observations by firm:

Code: Select all

series nobs = @obsby(Y, FIRM)
where Y is the name of your data series, and FIRM is the name of your series containing firm names (or identifiers).

Then contract that new page (Proc->Contract current page), using a sample of "if nobs>60".

Re: Continuous Observations - Panel Data

Posted: Mon Nov 28, 2011 10:54 am
by Amber
Dear Gareth, you are absolutely brilliant! It works perfectly, thanks so much! :D