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 <[email protected]>
To   [email protected]
Subject   Re: st: From spell to person-month file
Date   Wed, 29 Mar 2006 10:35:47 +0200

I still think an illustration would have helped, nonetheless, here is a shot

You have

person month file
Persnr month n_job
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

spell file
Persnr n_job beg end
1 1 1 3
1 2 4 7
1 3 8 10


When you say go back to the "person month file" carrying with you information from "spell file" my guess is that what you want is to add "beg" and "end" to the "person month file" (only guessing). If this is the case, you can add this directly to the "person month file"

egen beg = min(month), by(Persnr n_job)
egen end = max(month), by(Persnr n_job)

Persnr month n_job beg end
1 1 1 1 3
1 2 1 1 3
1 3 1 1 3
1 4 2 4 7
1 5 2 4 7
1 6 2 4 7
1 7 2 4 7
1 8 3 8 10
1 9 3 8 10
1 10 3 8 10



A. Manzoni wrote:

I simply want to go back to the original person month file, the one from
which I have generated the spell file, so I want the initial one back.

(Sure, actually I have saved the original one. But then I made some addition
in the spell file, so I want to go back to the original person month taking
with me also the variable I have added in the spell file, but the basic
structure is exactly the same.)


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ronnie Babigumira
Sent: woensdag 29 maart 2006 09:18
To: [email protected]
Subject: Re: st: From spell to person-month file

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/



*
*   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/

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index