Bookmark and Share

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]

st: Calculating months since entry into risk set by actor_id and month


From   Erik Aadland <[email protected]>
To   <[email protected]>
Subject   st: Calculating months since entry into risk set by actor_id and month
Date   Fri, 31 Aug 2012 14:23:28 +0000

Dear Statalist.
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. From this point on, I follow this actor monthly (MONTH) tracking whether the actor "gets sick" or not (EVENT). If the actor actor "gets sick", the actor is given an event score 1 as opposed to 0. If the actor never gets "sick" the actor is right censored at the end of the observation period.
By ACTOR_ID MONTH, I want to calculate the number of months since ACTOR_ID entered the risk set (or "contracted the infection) yielding the variable WANTED.
The dataset looks like this:
MONTH    ACTOR_ID    EVENT    WANTED
1        1           0        0
2        1           0        1
3        1           0        2
4        1           1        3
..       ..          ..
1        2           0        0
2        2           1        1
..       ..          ..
3        3           0        0
4        3           0        1
5        3           0        2
6        3           0        3
7        3           0        4
8        3           1        5
Any input on this problem would be very much appreciated.
Kind regards,
Erik. 		 	   		  
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index