Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: From spell to person-month file


From   Ronnie Babigumira <rb.glists@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: From spell to person-month file
Date   Wed, 29 Mar 2006 09:18:01 +0200

Not sure I follow. How would you like you final file to look like (you have illustrated the "person month file" and the "spell file", could you do the same for the "new person month file" you are trying to create)

A. Manzoni wrote:

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)?



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2020 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index