# st: Discrete-time survival analysis data setup

 From "sara khan" To statalist@hsphsun2.harvard.edu Subject st: Discrete-time survival analysis data setup Date Wed, 14 Mar 2007 16:32:46 +0000

```Dear Statalisters

I am new to Stata and and am working on a discrete time survival
analysis of unemployment transitions.

I wish to model the exits out of and re-entries into unemployment as
two separate models. I have read Stephen Jenkins's
course manuals, which were a fantastic learning resource, however, I
am unsure of what syntax to use to create my dependent variables:

1. Unemployment exit = 1 if a spell of unemployment ends at t-1 and
individual becomes employed at t, 0 =remains unemplyed and conditional
upon the first unemployment spell being observed;
2. Unemployment entry =1 if a spell of employment ends and individual
enters unemployment, 0=remains employed; conditional upon the first of
the spells before entry occurring being observed.

I have twelve annual panel waves and am using an unbalanced sample.
For unemployment duration, I have created variables for the spell year
(t), the spell number, when the spell ended, duration of spell, and
whether it is censored. Below is an example.

My question is how I create the exit and re-entry dependent variables.
I am unsure because there are multiple spells per individual in some
cases but I pnly want to model single spells. Also, I am not sure how
to condition these variables upon delayed entry as some spells began
before wave 1.

Any help would be appreciated. Thanks in advance.

Sara

ID	wave	unempd     t            spell num  spell end    duration   cens'd
1	1	1	1	1	1	1	1
------------------------------------------------------------------------------------------------------------------
2	1	1	1	1	1	1	0
2	2	0	2	0	0	0	0
-----------------------------------------------------------------------------------------------------------------
3	1	1	1	1	1	1	0
3	2	0	2	0	0	0	0
3	3	1	3	2	1	1	1
-----------------------------------------------------------------------------------------------------------------
8	2	0	1	0	0	0	0
8	4	0	2	0	0	0	0
8	7	1	3	1	0	2	0
8	8	1	4	1	1	2	0
8	9	0	5	0	0	0	0
8	10	0	6	0	0	0	0
8	11	1	7	2	1	1	0
8	12	0	8	0	0	0	0
------------------------------------------------------------------------------------------------------------------
10	1	0	1	0	0	0	0
10	2	0	2	0	0	0	0
10	3	0	3	0	0	0	0
10	4	0	4	0	0	0	0
10	6	1	5	1	1	1	0
10	8	0	6	0	0	0	0
10	10	0	7	0	0	0	0
10	11	1	8	2	1	1	0
10	12	0	9	0	0	0	0
*
*   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/
```