EconPapers    
Economics at your fingertips  
 

Speaking Stata: Identifying spells

Nicholas Cox ()

Stata Journal, 2007, vol. 7, issue 2, pages 249-265

Abstract: Spells in time series (and more generally in any kind of one-dimensional series) may be defined as sequences of observations that are homogeneous in some sense. For example, a categorical variable may remain in the same state, or values of a measured variable may satisfy the same true-false condition. Devices for working with spells in Stata include marking the start of each spell with indicator variables and tagging spells with integer codes. Panel data are easy to handle with the by: prefix. Some kinds of spell identification require two passes through the data, as when only spells of some minimum length are of interest or short gaps are tolerable within spells. Many questions concerning spells are easy to answer given careful use of by: and appropriate sort order, selection of just 1 observation from each panel or spell, and appreciation of the many functions written for egen. Gaps before, between, and after spells can also be important, and I suggest a convention for handling them.

Keywords: spells; runs; time series; data management (search for similar items in EconPapers)
Date: 2007

Downloads: (external link)
http://www.stata.com/bookstore/sjj.html link to individual issue purchase

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: http://EconPapers.repec.org/RePEc:tsj:stataj:v:7:y:2007:i:2:p:249-265

Ordering information: This journal article can be ordered from
http://www.stata-journal.com/subscription.html

Access Statistics for this article

Stata Journal is edited by H. Joseph Newton and Nicholas J. Cox

More articles in Stata Journal from StataCorp LP
Series data maintained by Christopher F. Baum ().

 
Page updated 2009-11-24
Handle: RePEc:tsj:stataj:v:7:y:2007:i:2:p:249-265