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

Re: st: Interval censored survival and stpm or intcens-correction

From   Steven Samuels <>
Subject   Re: st: Interval censored survival and stpm or intcens-correction
Date   Tue, 11 Sep 2007 07:52:22 -0400


The original code was correct, the correction was not....
Although Sharon mentioned that examinations took place at six month intervals, I suggest she use the actual days on study as her time variable, not "month", as illustrated here.


Here it is again.

Following is code which will convert -stset- multiple record data to a form that -intcens- can use.

/*************************CODE FOLLOWS ***************/

drop _all
set more off
capture log close
log using sharon01, replace text

input id month status
1 0 0
1 6 0
1 12 1
2 0 0
2 6 0
2 12 0
2 18 1
3 0 0
3 6 0
3 12 0

/* First identify people with event */
egen event=max(status), by(id)
tempfile temp0
save `temp0'

/* Intervals for people with events */

/* Start of interval */
keep if status==0 & event==1
bysort id (month): keep if _n==_N
rename month t0
tempfile temp1
save `temp1'
list id status event t0 t1

/* End of interval */
use `temp0',clear
keep if status==1
bysort id (month): keep if _n==1
rename month t1
merge id using `temp1'
tab _merge
drop _merge
tempfile temp3
save `temp3'

/* Censored observations- no events */
use `temp0'
keep if event==0
egen t0=min(month), by(id)
bysort id: keep if _n==1
gen t1=.
drop month

/* Final data */
append using `temp3'
sort id
list id t0 t1

On Sep 7, 2007, at 12:42 AM, Sharon Minnick wrote:


I have been attempting to analyze my interval censored survival data with either stpm or intcens ado's (From SSC). Both programs have been used in published papers (stpm: Royston and Parmar 2002; intcens: Griffin et al 2006). However, unless I am missing something, they don't seem able to handle multiple records per subject. In my study, subjects are bled and their serology checked at 6 month intervals. I want to be able to use the intervals when they were negative (and at risk) as well as the interval ending in seroconversion (or censoring) and I don't want to make only one interval per subject where some intervals will then be 2 or 3 years long. Does anyone have experience using either of these ado's in such a situation?
My data is in the span format with multiple records per subject. For each subject, _t0 is the first date of the span and _t is the second date of the span. There are no gaps, so _t for the first span is equal to _t0 for the second span.

In the intcens ado, the interval is specified as t0 and t1, there is no subject identifier. Intcens does not use stset parameters so I would lose some of the structure of my data.

For stpm, I have tried to define the left variable to specify that the observations are interval-censored by using _t0 as the left variable (which is < _t so according to the help file, when _d is 0, this will specify late entry at _t0 and right censoring at _t and when d is 1, this will specify interval censoring with an event in [_t0, _t]. I always receive the error message "

If anyone has used these ado files with interval censored data with multiple records per subject, I would appreciate a note as to whether or not it worked (and how to set it up).


Sharon Minnick
University of California at Davis
*   For searches and help try:

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