Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: re: finding the longest spell in a _set_ of variables for each panel unit

From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: re: finding the longest spell in a _set_ of variables for each panel unit
Date   Sat, 15 Jan 2005 11:08:50 -0500

'ONESPELL': module to generate single longest spell for each unit in panel data, listwise


onespell produces a subset of a panel data set in which all
observations on varlist are non-missing and contiguous in the
time dimension. If a panel unit contains more than one such
subset, the longest "spell" is retained. Although performing
this operation for a single variable of interest is fairly
straightforward, this routine deals with a more challenging
task: generating the single longest spell in a listwise fashion,
across a set of variables. This applies the same logic as does,
e.g., regress: an observation with a missing value in any
variable will be deleted from the regression sample. Some matrix
software (e.g., DPD for Ox) requires that panel data be organized
in this fashion, with each unit appearing as a single contiguous
block of non-missing observations. onespell will produce such a
dataset, which after conversion to Stata version 6 format (by,
e.g., Stat/Transfer) may be read directly by Ox. The routine has
been tested with the latest version of Ox (3.40) and the DPD
package (1.21). The routine makes use of N.J. Cox's -tsspell-.

Available from SSC.

Kit Baum, Boston College Economics

* For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index