Statalist


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

st: RE: stsplit for for data with multiple records per subject


From   "Weichle, Thomas" <Thomas.Weichle@va.gov>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: stsplit for for data with multiple records per subject
Date   Tue, 22 Dec 2009 15:35:20 -0600

I used the following stset command.  Then I merged a dataset which
contains multiple records per person which contains the vars after _t0.
I would like to split the data at the points where cross_over = 1.  This
represents that an individual switched from non-dual to dual user by our
definition or vice-versa (dual to non-dual user).  As you can see this
can happen multiple times in the study period (i.e. at 51, 232, and 260
days).  So for this individual, the data would be split 3 times
resulting in intervals of 0-51, 51-232, 232-260, and 260-365.25.  This
is what I would ideally like to see but I'm having trouble with the
stsplit syntax.

stset days, id(study_id) failure(died_1yr == 1) scale(365.25)

study_id	died_1yr	days		_st	_d	_t
_t0	dual_15_85_12mth	va_pcnt	dual_15_85_claims
dx_to_claim_day	cross_over	   
1		0		365.25	1	0	1	0
1			0		0			0
0	   
1		0		365.25	1	0	1	0
1			0		0			2
0	   
1		0		365.25	1	0	1	0
1			0		0			7
0	   
1		0		365.25	1	0	1	0
1			0.2		1			51
1	   
1		0		365.25	1	0	1	0
1			0.16666667	1			113
0	   
1		0		365.25	1	0	1	0
1			0.14285714	0			232
1	   
1		0		365.25	1	0	1	0
1			0.125		0			243
0	   
1		0		365.25	1	0	1	0
1			0.22222222	1			260
1	   
1		0		365.25	1	0	1	0
1			0.2		1			301
0	   
1		0		365.25	1	0	1	0
1			0.18181818	1			356
0	


Tom Weichle
Math Statistician
Center for Management of Complex Chronic Care (CMC3)
Hines VA Hospital, Bldg 1, C202
708-202-8387 ext. 24261
Thomas.Weichle@va.gov 


*
*   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   |   What's new   |   Site index