Erasmo--
To produce the output incorrectly identified in the original example
as a running sum (instead a total by spell):
tsset id year
ssc inst tsspell, replace
tsspell, cond(!missing(var1))
egen sum_var1=total(var1), by(id spell)
On 7/20/07, <[email protected]> wrote much that bears repeating, but:
<snip>
Cox, N.J. 2007. Identifying spells. Stata Journal 7(2): 249-265.
<snip>
The connections between this work on "identifying spells" and work of
any other past or present students of Hogwarts Academy is allusive,
elusive and illusory.
By the way, it seems that you have yet to read to the end of the
Statalist FAQ:
http://www.stata.com/support/faqs/res/statalist.html#spell
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/