Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: Re: Reshape and foreach for multiple failure analysis


From   graupel75@gmail.com
To   Statalist <statalist@hsphsun2.harvard.edu>
Subject   st: Re: Reshape and foreach for multiple failure analysis
Date   Wed, 8 Feb 2012 13:18:25 +0800

Hello everyone-

I am attempting to set up longitudinal data for multiple failure
analysis; I have consulted the Stata site (FAQ: Analysis of multiple
failure-time survival data) but have been unsuccessful on the reshape
to get there.

Current:

Where E1 to E4 are events, occurring at the specified number of weeks
from t0, and t_end is the total weeks of follow-up.

---------------------------------------------------------------------
ID        Group     E1        E2        E3        E4        t_end
1         1         2         .         .         .         48
2         5         6         12        18        .         36
...
---------------------------------------------------------------------

Needed (analogous to section 3.2.3 of the FAQ):

Where _time_ is the time elapsed from t0, _status_ is (1=event; 0=end
of observation), and _failnum_ is failure number.

----------------------------------------------------------
ID        Group     time0     time      status    failnum
1         1         0         2         1         1
1         1         2         48        0         2
2         1         0         6         1         1
2         5         6         12        1         2
2         5         12        18        1         3
2         5         18        36        0         4
...
----------------------------------------------------------

I have tried a whole range of _reshape_ options plus some _foreach_
loops with _egen_ to create the new matrix, but have been stymied.

Any suggestions would be superb!

thanks
Andrew Lover

___________________________________________________________
Epidemiologist
Centre for Infectious Disease Epidemiology Research (CIDER)
Saw Swee Hock School of Public Health
National University of Singapore
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index