I have spell data on employment with the corresponding firm id if employed.
I have calculated the tenure duration over time (tenure_cum) and the total tenure duration in a firm (tenure_max) according to the rule I imposed, which is: consider spell of unemployment (with no firm id) as employment spell in the same firm if begepi < endepi[_n-1] + 182 (i.e, the time distance between 2 employment spells in the same firm with an unemployment spell in between is < 6 months).
same_firm is a dummy equal to 0 when a new tenure-spell begins (i.e. first spell in a firm) and 1 when tenure continues (i.e. employment spell in the same firm which increases tenure in the firm).
I would like to have tenure_max of 43 not only in cells with employed=1 but also in those with employed=0 because unemployment is considered as a spell increasing tenure, just like an employmet spell. So 43 should be in tenure_max also in cells between same_firm=0 and same_firm=1 in which I have missings now.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long persnr int begepi long endepi float(spell duration employed same_firm tenure_cum tenure_max) 1 10768 10769 32 2 1 0 2 43 1 10856 10868 33 13 0 . . . 1 10869 10924 34 56 0 . . . 1 10932 10957 35 26 1 1 28 43 1 10958 10972 36 15 1 1 43 43 end format %d begepi format %d endepi
0 Response to Spell data - values between two spells, imputation
Post a Comment