Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Nick Cox <n.j.cox@durham.ac.uk> |

To |
"'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: Unbalanced to Balanced panel |

Date |
Tue, 8 Nov 2011 17:01:37 +0000 |

Suppose K = 8. Then this command drops all panels that have 9 or more observations. Is that what is wanted? (Of course changing = to >= doesn't by itself solve the problem because then the panels would be unbalanced.) (A secondary detail is that Muhammad's code does not depend on a prior -xtset-.) In many situations, researchers might well want to keep some years in a panel that is longer than the minimum acceptable length. The problem with the question is that only one unambiguous criterion is explicit -- that panels be balanced -- and little else is said. Maximising N * T is not a criterion easy to work with if N = 500, T = 1 and also N = 5, T = 100, not far from the truth in some fields. For example, 1. Is it important that panels be for exactly the same years? This is a question only researchers can answer. Sometimes it is crucial; at other times completely unimportant. 2. What about the trade off between number of panels and length of panels? Again the researcher must decide. If anyone offers a quick fix solution for this, it is likely to be of dubious merit unless it lets you consider these considerations, and others -- for example, balanced panels are not much good if depleted by missing values. -xtbalance- (SSC) is quoted, but not properly cited, by the original poster. Its approach is to specify the same time interval for all panels, but then optionally to drop any missing values! Optional or not, in what sense does balance help if there are missing values? Careful study of -xtdescribe- results seems vital to any good decision on this. -xtpatternvar- (SSC) is a helper program. Nick n.j.cox@durham.ac.uk Muhammad Anees after you do your data xtset id year; bys pid: gen nyear=[_N] keep if nyear==K where k is the number of years you want to keep data for and where every individual is traced. On Tue, Nov 8, 2011 at 11:08 AM, Vinod Mishra <vinod.mishra@live.com> wrote: > I have an unbalanced panel data and I want to make it balanced, such that I am left with the biggest possible 'N X T' balanced panel. Is there a stata program that automatically does that ? > > I am aware of stfill and xtbalance. But I don't think they do, what I want to do. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: Unbalanced to Balanced panel***From:*Vinod Mishra <vinod.mishra@live.com>

**Re: st: Unbalanced to Balanced panel***From:*Muhammad Anees <anees@aneconomist.com>

- Prev by Date:
**Re: st: Why do -intreg- and -truncreg- not give me the same SD as -summarize- ?** - Next by Date:
**RE: st: Confidence intervals: saving -proportion- estimates to a .dta or .csv file last estimates not found** - Previous by thread:
**Re: st: Unbalanced to Balanced panel** - Next by thread:
**st: age: factor variables may not contain noninteger values** - Index(es):