Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: split single records into multiple episode records


From   Marcus Casey <[email protected]>
To   [email protected]
Subject   st: split single records into multiple episode records
Date   Sun, 25 Oct 2009 20:46:41 -0400

Hi,

I have a  question that I hope somebody can help me with. I want to  
transform a single record into multiple records to analyze individual  
episodes with an spell specific id.


Specifically I have  panel data with the following form with year  
denoting year-quarter

id 	year 	   x 				
1      20001       1
1      20043       0
2      19973       1
3      20011       1
4     19974        0
4	20032       1


The year variable  denotes when an event occurred for the specific  
unit. I want to transform this data into
the following format (data starts in 19971 and assuming that only have  
non-left censored data):

id episode       begin		end				x
1	1           	  19971          20001		        9 (unknown)
1      2               20002		20043			1
1      3	          20044              .  (censored)	0
2      1               19971		19973			9
2      2               19974               .				1
3      1  		  19971         20011			9
3       2               20012             .				1
4      1		  19971		19974			9
4      2		  19981		20032			0
4	3		  20033		    .				1	

Could someone help me out with this? Thanks.


Regards,
Marcus

Marcus Casey
Duke University
Durham NC, 27708


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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