Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: problem of stset and stsum

From   Ronán Conroy <>
Subject   Re: st: problem of stset and stsum
Date   Fri, 11 Feb 2005 10:24:51 +0000 wrote:

Dear Statalist:

May I ask for help from stata experts?

Actually, Stata gave you a lot of help - have a look!

I have a hospital data with patient ID (hrn), separation dates (sep_date) and
discharge status (dis_sta2, for those deceased coded as 1 others as 0).
The causes of admission in the data are classified as either CHD (cond=1) or
other (cond=0). The data contains at least one CHD admission for each patient.
There are 5882 subjects with 21299 admissions.

I am trying to analyse the survival of patients with CHD, using the following
statement. I came across the following problems.
1. The result shows that only 2519 subjects are left, originally there are 5882.

Stata has given you a detailed breakdown of the reasons you have lost a lot of data. You have a problem with your dates, so that a lot of participants exit at or before the time they enter, and a lot more experience an event at or before they enter.

This problem seems to relate to your endpoint time, as the remaining observations have no events. Hence your second problem - Stata cannot calculated percentiles of the survival function unless the appropriate percentage of the participants have experienced an event.

2. 'Stsum' doesn't show me the survival time at 25%, 50% and 75%.

Could anyone tell me why?

See the Stata output below which you included in your email -



. stset sep_date, id(hrn) origin(cond=1) failure (dis_sta2=1)

id: hrn
failure event: dis_sta2 == 1
obs. time interval: (sep_date[_n-1], sep_date]
exit on or before: failure
t for analysis: (time-origin)
origin: cond==1

21299 total obs.
9839 obs. end on or before enter()
2062 obs. begin on or after (first) failure
9398 obs. remaining, representing
2519 subjects
0 failures in single failure-per-subject data
2360408 total analysis time at risk, at risk from t = 0
earliest observed entry t = 0
last observed exit t = 3561

. stsum

failure _d: dis_sta2 == 1
analysis time _t: (sep_date-origin)
origin: cond==1
id: hrn

| incidence no. of |------ Survival time -----|
| time at risk rate subjects 25% 50% 75%
total | 2360408 0 2519 . . .

. qui sort hrn sep_date

. qui by hrn: gen n=_n

. qui by hrn: gen N=_N

. sum one if n==1

Variable | Obs Mean Std. Dev. Min Max
one | 5882 1.984189 1.846311 1 16

* For searches and help try:


Ronan M Conroy ( Senior Lecturer in Biostatistics Royal College of Surgeons Dublin 2, Ireland +353 1 402 2431 (fax 2764) -------------------- Just say no to drug reps

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom
they are addressed.
If you have received this email in error please notify the
originator of the message. This footer also confirms that this
email message has been scanned for the presence of computer viruses.

Any views expressed in this message are those of the individual
sender, except where the sender specifies and with authority,
states them to be the views of The Royal College Of Surgeons in Ireland.


* For searches and help try:

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