[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: RE: How to construct a duration variable?
A slight modification is necessary:
tsset hhid per
encode b, gen(b2)
bysort hhid _spell: replace _seq = _seq[_N]
rename _seq duration
drop _* b2
-tsspell- creates _spell by:
= by hhid: gen long _spell = sum((brand != L.brand) | (_n == 1) & __000001)
while -spell- uses explicit subscripting.
> -----Original Message-----
> From: email@example.com [mailto:owner-
> firstname.lastname@example.org] On Behalf Of Nick Cox
> Sent: Thursday, April 06, 2006 3:00 PM
> To: email@example.com
> Subject: RE: st: RE: How to construct a duration variable?
> 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.
* For searches and help try: