My question attached in a .txt file
Anna
------------------------------------------------------------------------
I had a person month file like
Persnr month n_job(this indicates the order number of the spell)
1 1 1
1 2 1
1 3 1
1 4 2
1 5 2
1 6 2
1 7 2
1 8 3
1 9 3
1 10 3
From this I have created a spell file like this
Persnr beg end n_job
1 1 3 1
1 4 7 2
1 8 10 3
using -collapse-:
collapse (min) beg=month (max) end=month , by(Persnr n_job)
Now I would like to go back to the person month file. How could I do (considering that I have also additional info related to the job spell,e.g sector, isco code etc..- and I also have missing n_job, when there respondent was not employed in some months)?
Usually I use the expand function, after generating the number of month each spells lasts, but this causes some difficulties when in one month there is more than one spell, so the same month is there more than once.
Is there a better way to go back from the spell file (the 2nd I have described)to the person month dataset (the first one I have shown here)?