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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st:survival data format


From   Simon <scmoore.lists@googlemail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st:survival data format
Date   Mon, 22 Mar 2010 17:21:40 +0000

Getachew,

I think you might want to look at -snapspan- to start
getting your data into the right format:

input id time emp
 1 1 1
 1 2 1
 1 3 0
 1 4 0
 1 5 1
 2 1 1
 2 2 0
 2 3 1
 2 4 1
end

save temp.dta, replace
snapspan id time emp, generate(time0)

My version of snapspan insists that I save the data first.
Simon



On 22/03/2010 16:24, getachew Emrie wrote:
I was trying to set  my data in to survival data format. My Interest
is to look the duration of unemployment from CPS data.
The data i have has the following form.

   id   time     employment
   1      1               1
   1      2               1
   1      3               0
   1      4               0
   1      5               1
   2      1               1
   2      2               0
   2      3               1
   2      4               1

(employment=1 if employed and =0 if unemployed). My interest is to
follow the person when he/she enters in to unemployment and look the
time he/ she is going back to employment. Here failure is being
employed (=1). when i try to set it up using stset command with id and
failure=1,data starts with failure and stata ignores all the
observations after first failure. it tells me that most of the data
starts with failure. Is there any way tell stata to ignore failures
before risk of being unemployed  ( for example in the above data  i
want to ignore failures at time 1 and 2 and start at time 3 and then
fail at time 5 for id=1).

Thank you
Getachew.
*
*   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/
*
*   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