Dear all,
I am trying to set up a panel data and I have to reshape my dataset from wide to long. I have managed to setup panels for many other datasets but this one is different. This is the employment history for each individual. What makes this file different is that the variable ID does not uniquely identify the observations since many individuals can have multiple employment spell in a single year (or at least I think this is the problem).
see a small example of my dataset for the first 3 waves a, b and c and for few variables:
For example pidp 67335 has 2 employment spell for wave a, or pidp 49651 has 5 employment spell for wave b. I think that this makes impossible for STATA to uniquely identify the unique observation ID(i) wave(j). Do you have any thoughts?
Thanks
I am trying to set up a panel data and I have to reshape my dataset from wide to long. I have managed to setup panels for many other datasets but this one is different. This is the employment history for each individual. What makes this file different is that the variable ID does not uniquely identify the observations since many individuals can have multiple employment spell in a single year (or at least I think this is the problem).
see a small example of my dataset for the first 3 waves a, b and c and for few variables:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long pidp byte(a_jspno b_jspno c_jspno a_jhstpy b_jhstpy c_jhstpy) float(a_jhgpay b_jhgpay c_jhgpay) 30615 . . . . . . . . . 34007 . . . . . . . . . 34084 . . . . . . . . . 34084 . . . . . . . . . 34084 . . . . . . . . . 34122 . . . . . . . . . 34691 . . . . . . . . . 35375 . . 1 . . 1 . . 1186.6395 37411 . . 1 . . 2 . . 1365.933 38771 . 1 . . -8 . . -8 . 40924 . . . . . . . . . 40924 . . . . . . . . . 40924 . . . . . . . . . 41487 . 1 1 . 1 11 . 948.1022 1301.034 42171 1 1 1 1 1 2 915.9615 1084.2134 1207.4038 42847 . . . . . . . . . 46247 . 1 . . -8 . . -8 . 46927 . 1 1 . 7 7 . 866 866 46927 . 1 1 . 7 7 . 866 866 47619 . . . . . . . . . 47619 . . . . . . . . . 49651 . 3 1 . 5 5 . 649.5 649.5 49651 . 4 2 . -8 5 . -8 649.5 49651 . 1 2 . 5 5 . 649.5 649.5 49651 . 5 2 . -8 5 . -8 649.5 49651 . 2 2 . -8 5 . -8 649.5 50335 . . . . . . . . . 50335 . . . . . . . . . 54419 2 . . 2 . . 492.4366 . . 54419 1 . . -8 . . -8 . . 54482 . . . . . . . . . 65287 1 . . 3 . . 1338.6503 . . 65967 . 1 1 . 1 1 . 1124.1346 1065.9331 66651 . . . . . . . . . 67335 1 1 . -8 -9 . -8 777.4554 . 67335 2 1 . 2 -9 . 1665.3846 777.4554 . 68007 2 . . 11 . . 606.2 . . 68007 1 . . 3 . . 562.9 . . 68687 . . . . . . . . . 69375 . 2 1 . 3 -8 . 1118.6073 -8 69375 . 1 1 . -8 -8 . -8 -8 70047 1 . . 11 . . 1457.2115 . . 74811 . . . . . . . . . 76165 . . . . . . . . . 76165 . . . . . . . . . 76165 . . . . . . . . . 78887 1 1 . 11 7 . 537.2866 508.47095 . 79571 1 . . 11 . . 1096.9501 . . 80247 . . 1 . . 5 . . 789.124 80931 . . 1 . . -8 . . -8 80931 . . 1 . . -8 . . -8 end label values a_jhstpy a_jhstpy label def a_jhstpy -8 "inapplicable", modify label def a_jhstpy 1 "promoted", modify label def a_jhstpy 2 "left for better job", modify label def a_jhstpy 3 "made redundant", modify label def a_jhstpy 11 "other reason", modify label values b_jhstpy b_jhstpy label def b_jhstpy -9 "missing", modify label def b_jhstpy -8 "inapplicable", modify label def b_jhstpy 1 "promoted", modify label def b_jhstpy 3 "made redundant", modify label def b_jhstpy 5 "temporary job ended", modify label def b_jhstpy 7 "stopped health reas", modify label values c_jhstpy bc_jhstpy label def c_jhstpy -8 "inapplicable", modify label def c_jhstpy 1 "promoted", modify label def c_jhstpy 2 "left for better job", modify label def c_jhstpy 5 "temporary job ended", modify label def c_jhstpy 7 "stopped health reas", modify label def c_jhstpy 11 "other reason", modify label values a_jhgpay a_jhgpay label def a_jhgpay -8 "inapplicable", modify label values b_jhgpay b_jhgpay label def b_jhgpay -8 "inapplicable", modify label values c_jhgpay c_jhgpay label def c_jhgpay -8 "inapplicable", modify
For example pidp 67335 has 2 employment spell for wave a, or pidp 49651 has 5 employment spell for wave b. I think that this makes impossible for STATA to uniquely identify the unique observation ID(i) wave(j). Do you have any thoughts?
Thanks

Comment