I think Richard disagrees slightly, but -spell-, whiIe
it is still there on SSC for users of Stata 6, has not
been touched by either of us since 2000.
I'd recommend instead -tsspell-,
which is the successor maintained by me (with
ack'ts to Richard for his contributions). -tsspell-
is slightly more restrictive in insisting on -tsset-,
but in practice that limitation is no limitation.
It too is present on SSC.
Nick
[email protected]
Scott Merryman
> Here is one way. It makes use of Nick Cox and Richard
> Goldstein's -spell-.
>
> clear
> input hhid period str1 brand switch Duration
> 1 1 A 0 1
> 1 2 B 1 4
> 1 3 B 0 4
> 1 4 B 0 4
> 1 5 B 0 4
> 1 6 C 1 2
> 1 7 C 0 2
> 1 8 A 1 1
> 1 9 B 1 4
> 1 10 B 0 4
> 1 11 B 0 4
> 1 12 B 0 4
> 1 13 C 1 2
> 1 14 C 0 2
> end
>
> tsset hhid per
> spell b
> bysort hhid _spell: replace _seq = _seq[_N]
> rename _seq duration
> drop _*
> l
*
* 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/