Announcement

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

  • Find transition and change between waves


    Hello all

    I have data containing three waves (waves 2,3 and 4). This wave has a variable, depending on whether the person works part-time. Also, it has an occupation variable. I want to determine how many people in all waves stay in the same occupation. How does the percentage of people working part-time change? I want to see the transition between waves if the individuals track them by occupation). I need to end up with tables showing the transition between waves and changes in part-time and occupation.

    Note that the variable part-time is available in wave 2 and 4 only so this mean in wave 3 the data institute not ask this questions in wave 3. Therefore, I have assumed logically in my context, to some extent, if individuals can still work part-time regularly in Wave 4, this assumes they could probably still work part-time in Wave 3. So, in this case, I try to fill in the missing “par-time_inferred” values for wave 3 based on the same values in waves 2 and 4.

    I tried to use this code, but I found something that was not correct or did not work logically. Could anyone help with any ideas?

    Code:
    * Generate a variable to infer part time  status for missing waves
    gen partime_inferred = partime if !missing(partime)  
    replace partime_inferred = L.partime if wave == 3 & L.partime == F.partime & !missing(L.partime) & !missing(F.partime)  
    
    
    * Generate lagged versions of key variables to track transitions
    gen occ_lag1 = L1.occuaption if !missing(occuaption)
    gen occ_lag2 = L2.occuaption if !missing(occuaption)  
    
    gen partime_lag1 = L1.partime_inferred if !missing(partime_inferred)
    gen partime_lag2 = L2.partime_inferred if !missing(partime_inferred)  
    
    gen job_transition = .
    // Same job across all waves (should have identical occupation codes in all three waves)
    replace job_transition = 1 if occuaption == occ_lag1 & occ_lag1 == occ_lag2 & !missing(occuaption)
    
    // Changed job in wave 2 (job changed between wave 2 and 3, but remained the same between wave 3 and 4)
    replace job_transition = 2 if occuaption != occ_lag1 & occ_lag1 == occ_lag2 & !missing(occuaption)
    
    // Changed job in wave 3 (job stayed the same between wave 2 and 3, but changed between wave 3 and 4)
    replace job_transition = 3 if occuaption == occ_lag1 & occ_lag1 != occ_lag2 & !missing(occuaption)
    
    // Changed job in both waves (job changed between both wave 2 to 3 and wave 3 to 4)
    replace job_transition = 4 if occuaption != occ_lag1 & occ_lag1 != occ_lag2 & !missing(occuaption)
    
    * Generate part-time transition variable
    gen partime_transition3 = .
    replace partime_transition3 = 1 if partime_inferred == partime_lag1 & partime_lag1 == partime_lag2 & !missing(partime_inferred)
    replace partime_transition3 = 2 if partime_inferred != partime_lag1 & partime_lag1 == partime_lag2 & !missing(partime_inferred)
    replace partime_transition3 = 3 if partime_inferred == partime_lag1 & partime_lag1 != partime_lag2 & !missing(partime_inferred)
    replace partime_transition3 = 4 if partime_inferred != partime_lag1 & partime_lag1 != partime_lag2 & !missing(partime_inferred)
    
    
    tabulate job_transition
    tabulate partime_transition3
    tabulate job_transition partime_transition3

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long id byte(wave partime) int occuaption
       22445 4 1 611
       29925 4 .  .b
      280165 2 0 354
      280165 3 . 115
      280165 4 . 113
      387605 4 .  .b
      541285 3 . 922
      541285 4 .  .b
      541965 3 . 925
      599765 4 . 356
      665045 3 . 122
      665045 4 0 122
      813285 4 . 821
      956765 2 . 532
      956765 3 . 532
      987365 2 .  .b
      987365 3 . 922
     1114525 2 . 522
     1126765 2 .  .b
     1558565 2 .  .b
     1558565 3 .  .b
     1833965 2 . 611
     1833965 3 . 611
     1833965 4 . 611
     2292285 3 .  .b
     2292285 4 .  .b
     2401085 2 . 411
     2539125 2 0 711
     2626845 2 .  .b
     2626845 4 0 912
     2670365 2 0 711
     2670365 3 . 711
     2817245 2 .  .b
     2817245 4 0 912
     2853965 2 0 922
     2853965 3 . 312
     2853965 4 0 243
     2888645 3 . 721
     2888645 4 0 721
     2903605 2 .  .b
     2932845 3 . 621
     3621685 2 .  .b
     3658405 2 . 413
     3663845 4 . 524
     3705325 3 .  .b
     3705325 4 .  .b
     3720965 2 . 611
     3915445 2 0 925
     3915445 3 . 925
     3915445 4 0 321
     4091565 2 . 353
     4091565 3 .  .b
     4091565 4 1 231
     4192205 2 0 115
     4192205 3 . 115
     4192205 4 1 115
     4454005 2 .  .b
     4454005 3 .  .b
     4454005 4 .  .b
     4473725 3 . 111
     4473725 4 . 111
     4562125 2 0 212
     4562125 3 . 212
     4562125 4 . 212
     4626045 2 .  .b
     4626045 3 .  .b
     4626725 2 .  .b
     4626725 3 .  .b
     4794685 3 . 356
     4794685 4 1 356
     4849085 4 1 353
    68002045 2 . 231
    68002045 3 . 231
    68002049 2 1 343
    68002725 2 0 412
    68002725 4 0 412
    68004087 2 0 711
    68004087 3 . 711
    68004087 4 0 711
    68006127 2 .  .b
    68006127 3 .  .b
    68006127 4 .  .b
    68006135 3 . 611
    68006135 4 0 611
    68006139 3 .  .b
    68006139 4 . 612
    68006807 2 .  .b
    68006807 3 .  .b
    68006807 4 .  .b
    68007487 2 .  .b
    68007487 3 . 541
    68007487 4 . 541
    68007491 4 . 532
    68008167 2 .  .b
    68008171 2 . 811
    68008847 2 0 356
    68008847 3 . 356
    68008847 4 0 356
    68009527 2 0 921
    68009527 3 . 312
    end
    label values partime b_jbflex7
    label def b_jbflex7 0 "not mentioned", modify
    label def b_jbflex7 1 "mentioned", modify
    label values occuaption b_jbsoc00_cc
    label def b_jbsoc00_cc 111 "Corporate managers and senior officials", modify
    label def b_jbsoc00_cc 113 "Functional managers", modify
    label def b_jbsoc00_cc 115 "Financial institution and office managers", modify
    label def b_jbsoc00_cc 122 "Managers and proprietors in hospitality and leisure services", modify
    label def b_jbsoc00_cc 212 "Engineering professionals", modify
    label def b_jbsoc00_cc 231 "Teaching professionals", modify
    label def b_jbsoc00_cc 243 "Architects, town planners, surveyors", modify
    label def b_jbsoc00_cc 312 "Draughtspersons and building inspectors", modify
    label def b_jbsoc00_cc 321 "Health associate professionals", modify
    label def b_jbsoc00_cc 343 "Media associate professionals", modify
    label def b_jbsoc00_cc 353 "Business and finance associate professionals", modify
    label def b_jbsoc00_cc 354 "Sales and related associate professionals", modify
    label def b_jbsoc00_cc 356 "Public service and other associate professionals", modify
    label def b_jbsoc00_cc 411 "Administrative occupations: government and related organisations", modify
    label def b_jbsoc00_cc 412 "Administrative occupations: finance", modify
    label def b_jbsoc00_cc 413 "Administrative occupations: records", modify
    label def b_jbsoc00_cc 522 "Metal machining, fitting and instrument making trades", modify
    label def b_jbsoc00_cc 524 "Electrical trades", modify
    label def b_jbsoc00_cc 532 "Building trades", modify
    label def b_jbsoc00_cc 541 "Textiles and garments trades", modify
    label def b_jbsoc00_cc 611 "Healthcare and related personal services", modify
    label def b_jbsoc00_cc 612 "Childcare and related personal services", modify
    label def b_jbsoc00_cc 621 "Leisure and travel service occupations", modify
    label def b_jbsoc00_cc 711 "Sales assistants and retail cashiers", modify
    label def b_jbsoc00_cc 721 "Customer service occupations", modify
    label def b_jbsoc00_cc 811 "Process operatives", modify
    label def b_jbsoc00_cc 821 "Transport drivers and operatives", modify
    label def b_jbsoc00_cc 912 "Elementary construction occupations", modify
    label def b_jbsoc00_cc 921 "Elementary administration occupations", modify
    label def b_jbsoc00_cc 922 "Elementary personal services occupations", modify
    label def b_jbsoc00_cc 925 "Elementary sales occupations", modify

  • #2
    Nassar:
    you may want to take a look at -help xttab- and see if -xttrans- can help you out with that.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment

    Working...
    X