EconPapers    
Economics at your fingertips  
 

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

Christopher Baum

Statistical Software Components from Boston College Department of Economics

Abstract: 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-.

Language: Stata
Requires: Stata version 8.2
Keywords: panel data; spell; streak; run (search for similar items in EconPapers)
Date: 2005-01-15
Note: This module should be installed from within Stata by typing "ssc install onespell". The module is made available under terms of the GPL v3 (https://www.gnu.org/licenses/gpl-3.0.txt). Windows users should not attempt to download these files with a web browser.
References: Add references at CitEc
Citations:

Downloads: (external link)
http://fmwww.bc.edu/repec/bocode/o/onespell.ado program code (text/plain)
http://fmwww.bc.edu/repec/bocode/o/onespell.hlp help file (text/plain)
http://fmwww.bc.edu/repec/bocode/t/tsspell.ado program code (text/plain)
http://fmwww.bc.edu/repec/bocode/t/tsspell.sthlp help file (text/plain)

Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.

Export reference: BibTeX RIS (EndNote, ProCite, RefMan) HTML/Text

Persistent link: https://EconPapers.repec.org/RePEc:boc:bocode:s448601

Ordering information: This software item can be ordered from
http://repec.org/docs/ssc.php

Access Statistics for this software item

More software in Statistical Software Components from Boston College Department of Economics Boston College, 140 Commonwealth Avenue, Chestnut Hill MA 02467 USA. Contact information at EDIRC.
Bibliographic data for series maintained by Christopher F Baum ().

 
Page updated 2025-03-30
Handle: RePEc:boc:bocode:s448601