Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Splitting spell episodes that overlap a year

    Dear Statalist,

    I am working with episode data of the following form, where duration stands for the time span between begepi and endepi and UE is an unemployment dummy.
    Code:
    persnr   spell   begepi       endepi       duration   UE
    1        1       01jan1985    31dec1985    365        0
    1        2       01jan1986    31aug1986    243        0
    1        3       01sep1986    21jul1989    1055       1
    1        4       22jul1989    31jul1989    10         1
    1        5       01aug1989    31jul1990    365        0
    2        1       01jan2006    31dec2006    365        0
    2        2       01jan2007    30jun2007    181        0
    2        3       01jul2007    30jun2009    731        1
    My aim is, to split each spell that overlaps one year (duration>365) and create out of this spell, news spells that do not overlap one year. In this case I want to split spell 3 of person 1 and person 2, respectively. To give a short example, in the end I would create a dataset (more or less) looking like this:
    Code:
    persnr   spell   begepi       endepi       duration   UE
    1        1       01jan1985    31dec1985    365        0
    1        2       01jan1986    31aug1986    243        0
    1        3       01sep1986    21jul1989    1055       1
    1        .       01sep1986    31dec1986    .          .
    1        .       01jan1987    31dec1987    .          .
    1        .       01jan1988    31dec1988    .          .
    1        .       01jan1989    21jul1989    .          .  
    1        4       22jul1989    31jul1989    10         1
    1        5       01aug1989    31jul1990    365        1
    2        1       01jan2006    31dec2006    365        0
    2        2       01jan2007    30jun2007    181        0
    2        3       01jul2007    30jun2009    731        1
    2        .       01jul2007    31dec2007    .          .
    2        .       01jan2008    31dec2008    .          .
    2        .       01jan2009    30jun2009    .          . 
    Does anyone of you have an idea how to do so? My feeling is that stsplit might be helpful, but I haven't arrived.
    Thanks in advance for your help and your effort,

    Best wishes, Christopher
Working...
X