Good evening,
I have a dataset with one variable called occupation with values such as paid employment, job seeker following job loss, pensioner, etc. This is shown for every individual for multiple months:
Now I want to create a new variable regarding unemployment duration. I want to calculate how many months were in between individuals' occupation as "job seeker" followed by "paid employment".
So that means the unemployment duration for individual 1 was two months and the unemployment duration for individual 2 was one month, etc.
What is the correct code to calculate this?
Thank you very much!
I have a dataset with one variable called occupation with values such as paid employment, job seeker following job loss, pensioner, etc. This is shown for every individual for multiple months:
| individual | month | occupation |
| 1 | january | job seeker |
| 1 | february | job seeker |
| 1 | march | paid employment |
| 2 | january | job seeker |
| 2 | february | paid employment |
| 2 | march | paid employment |
| 3 | january | paid employment |
Now I want to create a new variable regarding unemployment duration. I want to calculate how many months were in between individuals' occupation as "job seeker" followed by "paid employment".
So that means the unemployment duration for individual 1 was two months and the unemployment duration for individual 2 was one month, etc.
What is the correct code to calculate this?
Thank you very much!

Comment