Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Rodrigo Alvarez <rbpalvarez@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: stset multiple-spell(recurrent) delayed entry |
Date | Fri, 10 Feb 2012 22:44:02 -0200 |
stset multiple-failure (recurrent) left and right-truncation with delayed entry and time-varying covariates Dear Statalisters, I have a problem in the implementation of stset for survival analysis and wondered if anyone could help me. (My question is also how to adjust the data to stset so that Stata understands that the "observation window" is not the same for all id, I'm not sure if I'm doing this in the right way) Specifically, I am studying the entry and exit of firms in export markets. The entire period that I notice is from 1998 to 2010, but I do not necessarily have information on all firms during this period, i.e. I have firms that are observed between 2000 and 2007, other between 2001 and 2005 etc. The event (failure) is the firm exit the export market when it was exporting in the previous year. Basically, I have to stset the data in Stata and I do not know the specific command or routine related to the data structure that I have, which is like an unbalanced panel in terms of Panel Data I tried: stset time1 , id(id) failure(failure) origin(dummy_exp==1) time0(time0) exit(time1) The firm 1, e.g.,was not at risk until 2006, when it became an exporter, and exported for 1 year (survival time) The output is as follows: id begin_obs time0 time1 dummy_exp failure _st _d _origin _t _t0 1 1 1998 1998 1999 0 0 0 2007 1 2 1998 1999 2000 0 0 0 2007 1 3 1998 2000 2001 0 0 0 2007 1 4 1998 2001 2002 0 0 0 2007 1 5 1998 2002 2003 0 0 0 2007 1 6 1998 2003 2004 0 0 0 2007 1 7 1998 2004 2005 0 0 0 2007 1 8 1998 2005 2006 0 0 0 2007 1 9 1998 2006 2007 1 0 0 2007 1 10 1998 2007 2008 0 1 0 2007 1 11 1998 2008 2009 0 0 0 2007 1 12 1998 2009 2010 0 0 0 2007 1 13 1998 2010 2011 0 0 0 2007 2 1 1998 1998 1999 1 0 0 1999 2 2 1998 1999 2000 1 0 0 1999 2 3 1998 2000 2001 1 0 0 1999 2 4 1998 2001 2002 1 0 0 1999 2 5 1998 2002 2003 1 0 0 1999 2 6 1998 2003 2004 1 0 0 1999 2 7 1998 2004 2005 1 0 0 1999 2 8 1998 2005 2006 1 0 0 1999 2 9 1998 2006 2007 1 0 0 1999 2 10 1998 2007 2008 1 0 0 1999 2 11 1998 2008 2009 0 1 0 1999 2 12 1998 2009 2010 0 0 0 1999 2 13 1998 2010 2011 0 0 0 1999 3 1 2000 2000 2001 0 0 0 3 2 2000 2001 2002 0 0 0 3 3 2000 2003 2004 0 0 0 3 4 2000 2004 2005 0 0 0 3 5 2000 2005 2006 0 0 0 3 6 2000 2006 2007 0 0 0 3 7 2000 2007 2008 0 0 0 3 8 2000 2008 2009 0 0 0 3 9 2000 2009 2010 0 0 0 3 10 2000 2010 2011 0 0 0 4 1 2004 2004 2005 1 0 0 2005 4 2 2004 2005 2006 1 0 0 2005 4 3 2004 2006 2007 1 0 0 2005 4 4 2004 2007 2008 1 0 0 2005 4 5 2004 2008 2009 0 1 0 2005 . . . And also tried: stset time1 , id(id) failure(failure) time0(time0) origin(time0==1998) and got: id begin_obs time0 time1 dummy_exp failure _st _d _t _t0 1 1 1998 1998 1999 0 0 0 1 2 1998 1999 2000 0 0 1 0 1 0 1 3 1998 2000 2001 0 0 1 0 2 1 1 4 1998 2001 2002 0 0 1 0 3 2 1 5 1998 2002 2003 0 0 1 0 4 3 1 6 1998 2003 2004 0 0 1 0 5 4 1 7 1998 2004 2005 0 0 1 0 6 5 1 8 1998 2005 2006 0 0 1 0 7 6 1 9 1998 2006 2007 1 0 1 0 8 7 1 10 1998 2007 2008 0 1 1 1 9 8 1 11 1998 2008 2009 0 0 0 1 12 1998 2009 2010 0 0 0 1 13 1998 2010 2011 0 0 0 2 1 1998 1998 1999 1 0 0 2 2 1998 1999 2000 1 0 1 0 1 0 2 3 1998 2000 2001 1 0 1 0 2 1 2 4 1998 2001 2002 1 0 1 0 3 2 2 5 1998 2002 2003 1 0 1 0 4 3 2 6 1998 2003 2004 1 0 1 0 5 4 2 7 1998 2004 2005 1 0 1 0 6 5 2 8 1998 2005 2006 1 0 1 0 7 6 2 9 1998 2006 2007 1 0 1 0 8 7 2 10 1998 2007 2008 1 0 1 0 9 8 2 11 1998 2008 2009 0 1 1 1 10 9 2 12 1998 2009 2010 0 0 0 2 13 1998 2010 2011 0 0 0 3 1 2000 2000 2001 0 0 0 3 2 2000 2001 2002 0 0 0 3 3 2000 2003 2004 0 0 0 3 4 2000 2004 2005 0 0 0 3 5 2000 2005 2006 0 0 0 3 6 2000 2006 2007 0 0 0 3 7 2000 2007 2008 0 0 0 3 8 2000 2008 2009 0 0 0 3 9 2000 2009 2010 0 0 0 3 10 2000 2010 2011 0 0 0 4 1 2004 2004 2005 1 0 0 4 2 2004 2005 2006 1 0 0 4 3 2004 2006 2007 1 0 0 4 4 2004 2007 2008 1 0 0 4 5 2004 2008 2009 0 1 0 . . . observing the variables _st (obs can be included in the study) , _d (outcome at the end of that spell) , _t, _t0 (time span tha obs lived) we can see that is not right... id 1, e.g., is being treated as if it lasts for 9 years when his spell lasted only one year! any suggestions will be appreciated! papers, routines, blogs...! Tks anyway Rodrigo Alvarez Economics - University of Sao Paulo - Brazil * * 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/