Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Calculating months since entry into risk set by actor_id and month
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: Calculating months since entry into risk set by actor_id and month
Date
Fri, 31 Aug 2012 15:42:01 +0100
The variable -wanted- (NO SHOUTING PLEASE ERIK) is in this example just
bysort actor_id (month) : gen wanted = _n - 1
I don't see what you desire if there is right censoring at the end,
but some technique is indicated by
bysort actor_id (month) : gen wanted = cond(event[_N] == 1, _n - 1, .)
Under -by:- the final value of -event- for each actor is just -event[_N]-.
Nick
On Fri, Aug 31, 2012 at 3:23 PM, Erik Aadland <[email protected]> wrote:
I have an event history dataset in which actors enter the dataset at
different points in time. Entry into the dataset constitutes the onset
of risk, or "contracting the infection" if you will, for that actor.