Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Generating an indicator of occurance of an event during the interval


From   "Le Wang" <[email protected]>
To   [email protected]
Subject   st: Generating an indicator of occurance of an event during the interval
Date   Thu, 14 Dec 2006 23:54:32 -0600

Hi there,

Thanks for your time in advance.

I have a data set containing four variables

(1) household id (2) event id (3) event outcome (4) order of success

event outcomes can takes on values of 1,2,3,4; if the event outcome is
2, it is successful and ordered according to the timing of occurance
of the success (recorded in the fourth variable "order of success").
The data looks like what follows,

-----------------------------------------------------------------------------------------
id	eventid	outcome	order of success
1	1	1	0
1	2	2	1
1	3	4	0
1	4	2	2
2	1	2	1
2	2	4	0
2	3	4	0
2	4	3	0
2	5	2	2
3	1	2	1
3	2	2	2
3	3	1	0
3	4	4	0
3	5	2	3
.
.
.
.
-----------------------------------------------------------------------------------------

What I wanna do is to create a variable for obs with the order of
success greater than 1; this variable indicates whether or not there
exists an event outcome equal to 4 during the interval between this
success and the previous success. The final data for the example
should look like the following

-----------------------------------------------------------------------------------------

id	eventid	outcome	order of success	indicator
1	1	1	0	.
1	2	2	1	.
1	3	4	0	.
1	4	2	2	1
2	1	2	1	.
2	2	4	0	.
2	3	4	0	.
2	4	3	0	.
2	5	2	2	1
3	1	2	1	.
3	2	2	2	0
3	3	1	0	.
3	4	4	0	.
3	5	2	3	1
.
.
.
.
-----------------------------------------------------------------------------------------

Le

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Le Wang, Ph.D.
Minnesota Population Center
University of Minnesota
(o) 612-624-5818
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index