|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: First instance of starting and stopping drug
The data are longer than that Svend!
id datestart datestop
1 1stJan01
1 12thJan02
2 1stFeb01
2 1stFeb01
2 1stApr04
2 1stApr04
2 1stJan07
3 1stJan03
3 censordate
Two points:
the patient can start drug before she attends our clinic
the patient can stop and start on the same day (it is actually a
hormonal implant, removed at end of life span and another inserted at
same visit).
We want to measure the continuation rate for the first episode of
implant use that we inserted ourselves. Data should look like this
id datestart datestop
1 1st Jan01 12th Jan02
2 1st Feb01 1stApr04
3 1stJan03 censordate
So, we want the first datestart on the same row as the next datestop.
Paul
On 3/13/08, Svend Juul <[email protected]> wrote:
Paul wrote:
We have a database of patients on and off a drug in the long form,
some stopping before starting later. I want to do a survival analysis
on the first instance of starting and stopping use under our care, but
have difficulty isolating the first episode of use.
=============================================================
I assume that long form means something like this:
clear
input id timeon timeoff
1 1 3
1 6 7
2 1 5
2 6 9
end
You want to keep the first treatment period for each id:
by id (timeon), sort: generate incl = _n==1
keep if incl==1
sort id timeon
list
+------------------------------+
| id timeon timeoff incl |
|------------------------------|
1. | 1 1 3 1 |
2. | 2 1 5 1 |
+------------------------------+
Hope this helps
Svend
__________________________________________
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000 Aarhus C, Denmark
Phone: +45 8942 6090
Home: +45 8693 7796
Email: [email protected]
__________________________________________
*
* 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/
*
* 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/