[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"K.O. Ivanova" <K.O.Ivanova@rug.nl> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: R: a person-period multi-episode event history file |

Date |
Wed, 07 Oct 2009 14:48:50 +0200 |

Thank you, Carlo. I will try your suggestion out. Best, Katya Carlo Lazzaro wrote: > Katya wrote: > > > <Basically, I have 1513respondents 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).> > > This would seem a minor matter of concern, since I suppose that is the > observation span of time that matters. Hence, you can set t0 when the > subject comes to your attention unless enrolling subjects at different times > may influence, for whatever reason , the result of your analysis. > > <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.> > > Are you sure you cannot switch to Stata built-in Survival Analysis > procedures? > > Otherwise, you can create an ad hoc variable and define value labels for > each event you are interested in (please, type - help label - in Stata) > > label define event 1 "unemployment" > label define event 2 "on the job training" > label define event 3 "on holidays" > > and so on and so forth > > Then, you can: > > count if event==1 & id==1 & month=="Jan_01" > > <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.> > > This is a very temptative answer: > g dating_index=1 if Start rel_n !="." $ End rel_n=="." > > Sorry I cannot be more helpful. > Kind Regards, > Carlo > -----Messaggio originale----- > Da: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] Per conto di K.O.Ivanova > Inviato: lunedì 5 ottobre 2009 17.02 > A: statalist@hsphsun2.harvard.edu > Oggetto: st: a person-period multi-episode event history file > > 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/ > > > > * > * 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/ > * * 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/

**References**:**st: R: a person-period multi-episode event history file***From:*"Carlo Lazzaro" <carlo.lazzaro@tin.it>

- Prev by Date:
**st: AW: Stata Inbuilt commands** - Next by Date:
**Re: st: displaying a subscript in a graph** - Previous by thread:
**st: R: a person-period multi-episode event history file** - Next by thread:
**st: Not sorted error in forvalues loop** - Index(es):

© Copyright 1996–2014 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |