Statalist


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

st: selecting random matched controls: survival


From   Michael McCulloch <[email protected]>
To   Statalist <[email protected]>
Subject   st: selecting random matched controls: survival
Date   Mon, 24 Dec 2007 11:11:38 -0800

Dear Statalist members,

I would like to ask help in a routine for selecting random matched controls in a survival dataset.

I have patients (tx=1) and controls (tx=0), and have _stset_.
Time from diagnosis to death = _t.
In the patients, I also know the time between diagnosis and treatment (leadtime).

I wish to randomly select two controls per patient, from among all controls who have survived at least as long as the leadtime for that patient. For example, subject ID==1 has eligible controls:
ID==12 | ID==13 | ID==14
Therefore, I'd like to randomly select two controls from among those three eligible controls.

ID tx _t leadtime
1 1 1.0 0.4
2 1 1.2 0.3
11 0 0.1
12 0 0.9
13 0 1.1
14 0 0.5

May I ask how this can be done in a do-file or small program?

Happy Holidays to all,

--

Michael McCulloch
Pine Street Foundation
124 Pine St., San Anselmo, CA 94960-2674
Tel: (415) 407-1357
Fax: (415) 485-1065
[email protected]
www.pinestreetfoundation.org
*
* 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