Hello, I have a dataset that looks like the toy example below: each observation represents an employment spell of a given individual (id), where by employment spell I mean the length of time (defined by start_date and end_date) the individual has worked for a given firm. Periods of time that are unaccounted for (as is the case for id 1 between ending his work at firm B and starting at C) are assumed to be unemployment spells. I am also assuming that the first employment spell for an individual is the start of his work life.
I need to be working with a monthly panel, so I want to reshape my dataset so that it looks like this:
Essentially I want a panel where time is my monthly date, and each observation tracks the status of each individual (employed being 1 if the individual is working in a given firm, and 0 if that month the individual is assumed to be unemployed). How can I do so in an economical way? I can't seem to be able to figure out a straightforward solution. I am also not sure if I should aim for a balanced panel (i.e. tracking all individuals from a given starting date, let's say January 1990, regardless of when their work life actually started) or not.
Any suggestion on how to proceed?
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float id str1 firm float(start_date end_date) 1 "A" 18995 19205 1 "B" 19206 21870 1 "C" 22071 . 2 "D" 14432 22578 3 "A" 20953 22280 3 "D" 22281 . end format %td start_date format %td end_date
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float id str3 firm float(time employed) 1 "A" 624 1 1 "A" 625 1 1 "A" 626 1 . "." . . 1 "A" 630 1 1 "B" 631 1 . "." . . 1 "B" 718 1 1 "" 719 0 1 "" 720 0 . "." . . 1 "" 724 0 1 "C" 725 1 2 "D" 474 1 . "." . . 2 "D" 741 1 end format %tm time
Any suggestion on how to proceed?
Comment