Announcement

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

  • Working with duration data

    My duration data is like this table where V1 is the status (1 mean employment , 2 unemployment, 3 not in labor market) corresponding to 12 months in year. In each year individual i can change his status.
    Code:
    clear all
    input double id year str12 V1
    1 2010 "111111122222"
    1 2011 "222111111111"
    1 2012 "111111111111"
    1 2013 "111122222222"
    2 2010 "222222222222"
    2 2011 "221111111111"
    2 2012 "111111122222"
    2 2013 "111111333333"
    end
    I would like to create 4 variables (V2 V3 V4 V5) that correspond to the duration.
    V2: If the individual is employed at the date of the first interview (V1=1&year 2008), count the duration in employment (V1=1) before other event and stop if other event appear.
    V3: If the individual is unemployed at the date of the first interview (V1=2 &year=2008), count the duration in employment after exit out of unemployment until another different status and stop.
    V4: If the individual is unemployed at the date of the first interview (V1=2&year 2008), count the duration in unemployment (V1=2) before other event and stop if other event appear.
    V5: If the individual is employed at the date of the first interview (V1=1&year=2008), count the duration in unemployment after exit out of employment until another different status and stop.

    What I hope to have is the following
    Code:
    input double id year str12 V1 V2 V3 V4 V5
    1 2010 "111111122222" 7 . 8 .
    1 2011 "222111111111" . . . . .
    1 2012 "111111111111" . . . . .
    1 2013 "111122222222" . . . . .
    2 2010 "222222222222" . 17 . 14 .
    2 2011 "221111111111" . . . . .
    2 2012 "111111122222" . . . . .
    2 2013 "111111333333" . . . . .
    
    end
Working...
X