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: Identifying and recording the first occurrence of an event by actor given category
From
Erik Aadland <[email protected]>
To
<[email protected]>
Subject
st: Identifying and recording the first occurrence of an event by actor given category
Date
Fri, 7 Sep 2012 09:07:45 +0000
Dear Statalist.
I have an unbalanced panel dataset.
This is the structure:
actor_id year category_id event
1 2000 1 .
1 2000 2 1
1 2001 2 1
2 2003 3 .
2 2003 2 1
2 2004 2 .
I want to generate a variable -first_occurrence- that identifies and records for each actor_id the first time the actor experienced event = 1 if the category = e.g. 2. I would like this -first occurrence- variable to capture the value of -year- at the time of first event occurrence. Some actors never experience event = 1.
For instance, if I track first occurrence by category_id = 2, this is what I look for:
actor_id year category_id event first_occurrence
1 2000 1 . 2000
1 2000 2 1 2000
1 2001 2 1 2000
2 2003 3 . 2003
2 2003 2 1 2003
2 2004 2 . 2003
Any input or suggestions on this problem would be greatly 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/