Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[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 <erikaadland@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index