Hi Stata Users,
I'm struggling with constructing variables using panel data (I'll eventually use sequence analysis). I know that I've to use tsspell from ssc, but I nevertheless got stuck.
My data reflect individual labor market careers in the wide format. For each spell, I've a variable indicating (1) the number of the start month of the spell, (2) the number of the end month of the spell, and (3) the status reflecting the spell. The variable name carries the chronological order of the spell (1 thru a maximum of 62). The month number could've been any, mine happens to be organized from #717 thru #1352 (more than half a century of monthly observations).
For my particular analysis, I'm not just interested in the order of the spells, but also in the timing of the careers: month-by-month. So, I'm looking to construct as many variables as there are months in my dataset (717 thru 1352), each reflecting the status in that particular month (instead of spell). I therefore somehow have to tell Stata to create variables that pull each number between "startmonth1" and "endmonth1" and fill this cell with whatever is in "status1". I can then repeat this for any other spell. I realize this will lead to a huge datamatrix (in wide form), but it's the one I need for the sequence analysis.
Any idea of how to code this (using tsspell)?
Best,
Dirk
I'm struggling with constructing variables using panel data (I'll eventually use sequence analysis). I know that I've to use tsspell from ssc, but I nevertheless got stuck.
My data reflect individual labor market careers in the wide format. For each spell, I've a variable indicating (1) the number of the start month of the spell, (2) the number of the end month of the spell, and (3) the status reflecting the spell. The variable name carries the chronological order of the spell (1 thru a maximum of 62). The month number could've been any, mine happens to be organized from #717 thru #1352 (more than half a century of monthly observations).
For my particular analysis, I'm not just interested in the order of the spells, but also in the timing of the careers: month-by-month. So, I'm looking to construct as many variables as there are months in my dataset (717 thru 1352), each reflecting the status in that particular month (instead of spell). I therefore somehow have to tell Stata to create variables that pull each number between "startmonth1" and "endmonth1" and fill this cell with whatever is in "status1". I can then repeat this for any other spell. I realize this will lead to a huge datamatrix (in wide form), but it's the one I need for the sequence analysis.
Any idea of how to code this (using tsspell)?
Best,
Dirk
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(id startmonth1 endmonth1 status1 startmonth2 endmonth2 status2) 1 717 726 1 726 750 7 2 1287 1293 1 1293 1323 1 3 745 750 1 750 764 1 4 618 755 1 755 911 3 5 871 892 1 892 906 6 6 1208 1256 1 1256 1285 7 end label values status1 estatverF label values status2 estatverF label def estatverF 1 "employed any", modify label def estatverF 3 "farmer", modify label def estatverF 6 "parental leave", modify label def estatverF 7 "studying", modify
Comment