Announcement

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

  • Dummy for 3 groups

    Hi everyone

    I am working with Panel Data, and I want to differentiate between three groups: Industry stayers, Industry movers and unemployed.

    In my Data some individuals (ID) during their working time (year) have changed the Industry. Some other individuals have kept their job in the same Industry. And some persons remain uneployed.
    I need to generate a dummy that estimates those changes in the end of period (2011) for Industry stayers, industry movers and unemployed

    The data looks like below:
    ID Year Industry
    1 2009 3
    2 2009 3
    3 2009 4
    1 2010 3
    2 2010 4
    3 2010 .
    1 2011 3
    2 2011 4
    3 2011 .
    Thnx. in Advance!
    Vilson

  • #2
    I'm not entirely clear what you want to do with the unemployed (I assume they are represented as missing values). I included a 4th id where the individual is unemployed for the entire period to help clarify.


    Code:
    input id year industry
    1 2009 3
    2 2009 3
    3 2009 4
    4 2009 .
    1 2010 3
    2 2010 4
    3 2010 .
    4 2010 .
    1 2011 3
    2 2011 4
    3 2011 .
    4 2011 .
    end
    
    sort id year
    list, sepby(id)

    Here are a few options:

    Code:
    *dummy variable where industry mover is 1, stayer is 0
    *any person unemployed at anytime is coded missing
    
    by id (industry), sort: gen move1 = industry[1] != industry[_N] if !mi(industry[_N])
    
    
    *dummy variable where industry mover is 1, stayer is 0
    *any id unemployed for part of the period is coded 1 (unemployed mover)
    *any id unemployed for the entire period is coded 0 (unemployed stayer)
    
    by id (industry), sort: gen move2 = industry[1] != industry[_N]
    
    **change the code to get stayers
    *dummy variable where industry mover is 1, stayer is 0
    *any id unemployed at anytime is coded missing
    
    by id (industry), sort: gen stay1 = industry[1] == industry[_N] if !mi(industry[_N])
    
    
    *dummy variable where industry mover is 0, stayer is 1
    *any id unemployed for part of the period is coded 0 (unemployed mover)
    *any id unemployed for the entire period is coded 1 (unemployed stayer)
    
    by id (industry), sort: gen stay2 = industry[1] == industry[_N]
    
    list, sepby(id)

    The logic behind the code can be found here: http://www.stata.com/support/faqs/da...ions-in-group/

    StataNow/MP 19.5 (64-bit x86-64)
    Win 11

    Comment

    Working...
    X