Announcement

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

  • Identifying spells after a specific event in panel datasets.

    Dear Statalist users:

    I am using in Stata 13 a panel dataset that contains several education- and labour-related spells for each individual. For instance, study periods, working periods, inactivity periods, etc. Every spell can be chronologically delimited by a start month ('mes_inicio') and year ('y6_ylhcs_begdaty') and by an end month ('mes_fin') and year ('y6_ylhcs_enddaty'). Each spell appears in the dataset as a different row of data, so that there are as many rows for a given individual as spells are registered for that individual. During some of these spells (namely, the education-related ones), individuals may achieve an educational diploma ('diploma_ola6) that qualifies them for enrolling in certain educational institutions or, alternatively, to go into the labour market or just go into inactivity. I am interested in studying the post-diploma transitions. That is, what people do after getting the diploma. The problem that I have and the one I request your help for is that I don't know how to identify only those spells that come immediately after the spell during which individuals got the educational diploma. This is important because I would like, for instance, to create a frequency table that shows the educational or labour destinations or to model the chances of making the transition to any of these destinations ignoring the spells that come before getting the aforementioned educational diploma.

    Find below an example of my dataset to try to understand its structure and my problem. For example, for 'indivdual 3', I want to identify the spell that comes immediately after the spell when s/he gets the Abitur diploma (diploma_ola6=1), which happens to be 'other activities' (y6_ylhcs_spt1=3).

    `
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long youthid byte y6_ylhcs_spt1 float mes_inicio int y6_ylhcs_begdaty float mes_fin int y6_ylhcs_enddaty float diploma_ola6
    individual 1 1   9 2010   7 2012 .
    individual 1 1   8 2012   8 2015 3
    individual 1 2   8 2015   9 2015 .
    individual 1 1   9 2015   2 2016 .
    
    individual 2 1 1.5 2009 6.5 2012 .
    individual 2 1 6.5 2012 6.5 2014 2
    individual 2 2 6.5 2014 6.5 2015 .
    individual 2 2 6.5 2015   3 2016 .
    
    individual 3 1 6.5 2006 6.5 2012 .
    individual 3 1 6.5 2012   3 2015 1
    individual 3 3   4 2015   6 2015 .
    individual 3 2   7 2015   3 2016 .
    individual 3 1  10 2015   4 2016 .
    
    individual 4 1   7 2006   7 2011 .
    individual 4 1   8 2011   6 2013 2
    individual 4 3   7 2013   8 2013 .
    individual 4 1   9 2013   4 2016 .
    
    end
    label values youthid youthid
    label values y6_ylhcs_spt1 y6_ylhcs_spt1
    label def y6_ylhcs_spt1 1 "education", modify
    label def y6_ylhcs_spt1 2 "employment", modify
    label def y6_ylhcs_spt1 3 "other activities", modify
    label values mes_inicio y6_ylhcs_begdatm
    label def y6_ylhcs_begdatm 4 "april", modify
    label def y6_ylhcs_begdatm 7 "july", modify
    label def y6_ylhcs_begdatm 8 "august", modify
    label def y6_ylhcs_begdatm 9 "september", modify
    label def y6_ylhcs_begdatm 10 "october", modify
    label values y6_ylhcs_begdaty y6_ylhcs_begdaty
    label values mes_fin y6_ylhcs_enddatm
    label def y6_ylhcs_enddatm 2 "february", modify
    label def y6_ylhcs_enddatm 3 "march", modify
    label def y6_ylhcs_enddatm 4 "april", modify
    label def y6_ylhcs_enddatm 6 "june", modify
    label def y6_ylhcs_enddatm 7 "july", modify
    label def y6_ylhcs_enddatm 8 "august", modify
    label def y6_ylhcs_enddatm 9 "september", modify
    label values y6_ylhcs_enddaty y6_ylhcs_enddaty
    label values diploma_ola6 diploma_ola6
    label def diploma_ola6 1 "Abitur", modify
    label def diploma_ola6 2 "Fachabitur", modify
    label def diploma_ola6 3 "Vocational degree", modify
    Thank you very much for your attention and apologies for the inconvenience.

  • #2
    It's not clear what you mean by 'identify spells only after getting a diploma' (example questions: how long or how many events after getting the diploma, do you just want to flag them or summarize the transitions in some way, etc). A good place to start is to use the bysort prefix and subscripting to help flag observations that match your criteria. I suggest starting with these helpful resources:

    https://www.stata-journal.com/sjpdf....iclenum=pr0004

    https://journals.sagepub.com/doi/10....867X0700700209

    https://www.stata-journal.com/sjpdf....iclenum=dm0033
    Eric A. Booth | Senior Director of Research | Far Harbor | Austin TX

    Comment


    • #3
      Originally posted by eric_a_booth View Post
      It's not clear what you mean by 'identify spells only after getting a diploma' (example questions: how long or how many events after getting the diploma, do you just want to flag them or summarize the transitions in some way, etc). A good place to start is to use the bysort prefix and subscripting to help flag observations that match your criteria. I suggest starting with these helpful resources:

      https://www.stata-journal.com/sjpdf....iclenum=pr0004

      https://journals.sagepub.com/doi/10....867X0700700209

      https://www.stata-journal.com/sjpdf....iclenum=dm0033
      Eric, thank you very much for your answer and for the materials you link in the message.

      Basically, I want to create a new variable that indicates which is the spell that comes immediately after (in time) the spell in which the diploma was achieved. In the example I use in my first post, the spell "other activities" that follows the achievement of the diploma would be coded in this new variable as "first spell after achieving the diploma". This way, I can compute a frequency table in which I would only see the frequency distribution of the spell types that come after getting the diploma.

      Comment

      Working...
      X