Create panel data from time-span data
spell2panel [clist] , spell(date0 date1) p(period) [by(varlist) nojoin]
where clist can be a varlist or
where clist can be [(stat)] varlist [ [(stat) ... ]
and stat is either mean or sum
spell2panel creates a panel from time-span data.
By default overlapping spells are broken up in disjoint adjacent spells. clist with statistics instructs how to treat variables when spells overlap; to sum them or take an average.
As an example, if two overlapping spells refer to a job and the variable is hours worked one would like to sum (to get the total hours worker), whereas if the variable is the worker's age one would like to take the average (which will just be the worker's age).
Option nojoin allows the user to avoid the above procedure. Note that spell2panel only generates sensical results if spells do not overlap.
spell(date0 date1) start and end date of spell.
p(period) define aggregation period: y,h,q,m,w,d. That is: yearly, halfyearly, quarterly, monthly, weekly, daily.
by(varlist) defines the groups (id's) for which the panel must be constructed.
Thanks to Barbara Sianesi for suggesting the clever use of expand and pointing me to Stata's time series formats.
E. Leuven, Department of Economics, University of Amsterdam. If you observe any