Hello, all.
I am struggling with the following problem: I am trying to create a
person-period multi-episode event history file. Basically, I have 1513
respondents and each one has been followed for 60 months (which are
not identical for all respondents – for example, one is followed from
Nov 01 to Nov 06 and another one from Jun 02 to Jun 07, and so on).
What I need is to create a 0/1 variable for each one of those months
denoting whether or not a certain event has taken place for that
person. It is easy when it is an event which occurs only once (e.g.,
divorce of biological parents). It gets more complicated however, when
I have events which not only can occur multiple times but also have
different durations.
In my case, that problem comes from the “dating status of the
adolescent” variable. What I have right now are two variables per
dating episode, one denoting start of dating episode and the other
one, end of dating episode. I have also created 60 variables per
respondent denoting the end of each “individual-specific” month of
observation. What I need to do now is create a “dating status”
variable per month which has the value of 1 if the adolescent was
dating in that month and a value of 0 if they weren’t.
Basically, I need to get from something like this:
Id Start rel 1 End rel 1 Start rel 2 End rel 2
1 Apr 01 Jul 01 Sept 01 Dec 01
2 May 02 still going on
To something like this:
Id Calendar mo # of mo of obs Dating status Dating index
of obs
1 Jan 01 1 0 0
1 Feb 01 2 0 0
1 Mar 01 3 0 0
1 Apr 01 4 1 1
1 May 01 5 1 1
1 Jun 01 6 1 1
1 Jul 01 7 1 1
1 Aug 01 8 0 0
1 Sep 01 9 1 2
1 Oct 01 10 1 2
1 Nov 01 11 1 2
1 Dec 01 12 1 2
2 Mar 02 1 0 0
2 Apr 02 2 0 0
2 May 02 3 1 1
2 Jun 02 4 1 1
2 Jul 02 5 1 1
2 Aug 02 6 1 1
2 Sep 02 7 1 1
2 Oct 02 8 1 1
2 Nov 02 9 1 1
2 Dec 02 10 1 1
2 Jan 02 11 1 1
2 Feb 02 12 1 1
To answer a possible question – yes, I do need to maximally expand the
data. I cannot stop the clock at first change in dating status. I want
to have all the information from start of observation to interview
date.
Can anyone help me out with the syntax? Thank you!
Katya
*
* 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/