Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Proc lifetest mean calculation

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 05-04-2020 09:20 AM
(927 views)

I have calculated the mean and median survival time from proc lifetest

```
proc lifetest data=graph2;
ods output means = mean_surv quartiles= median_surv;
time time*status(0);
strata brand;
run;
```

However I cannot understand how this is calculated.

```
data have ;
input ID start_dt date9. end_dt date9. membership_end_dt date9. status brand ;
datalines;
1 01Jan2012 02Feb2013 02Sep2013 1 a
2 15Jan2012 25Feb2013 02Sep2012 0 a
3 19Jan2012 12Feb2013 22Sep2013 1 a
4 22Jan2012 06Feb2013 02Sep2012 0 b
5 01Jan2012 02Feb2013 02Sep2013 1 c
;
data have2;
set have;
cal_end = min(end_date,membership_end_dt );
time = cal_end - start_date ;
format cal_end date9.;
run;
```

This data is medication use data, we have the start and end date of episodes for each ID and membership end date as well. If the end_date of episode is greater than the membership date then we censor that to the membership end date( as we dont want to measure the time on medication if the ID is not enrolled) . Status is the variable which which IDs are censored.

I use the proc lifetest on have2 dataset and measure the mean and quartiles.

Q1what is the formula used for measuring this mean?

.If I use the have2 dataset to measure mean time then I get a very different result. why is that?

Q2. why are quartiles missing for some brands?

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hello @riyaaora275,

You can find the formulas for estimated mean and median survival time in section "Breslow, Fleming-Harrington, and Kaplan-Meier Methods" of the PROC LIFETEST documentation. Both formulas involve *Kaplan-Meier estimates* (because you used the default, KM, of option METHOD= of the PROC LIFETEST statement), so to replicate the results you would need to compute these first or take the values from table "Product-Limit Survival Estimates" in the PROC LIFETEST output (or the corresponding output dataset if you specify the OUTSURV= option).

Example: For brand=a in your sample data you have t_{0}=0, t_{1}=231, t_{2}=390 and t_{3}=398. The corresponding KM-estimates are 1, 1, 0.5 and 0, respectively. The estimated mean survival time is then computed as

`1*(231-0)+1*(390-231)+0.5*(398-390)=394`

If the Kaplan-Meier curve (i.e. the KM-estimates) does not drop below 0.75 (0.5, 0.25), the first quartile (median, third quartile) cannot be estimated (as is the case for brand=b in your sample data). This is possible only if the largest survival time is censored.

1 REPLY 1

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hello @riyaaora275,

You can find the formulas for estimated mean and median survival time in section "Breslow, Fleming-Harrington, and Kaplan-Meier Methods" of the PROC LIFETEST documentation. Both formulas involve *Kaplan-Meier estimates* (because you used the default, KM, of option METHOD= of the PROC LIFETEST statement), so to replicate the results you would need to compute these first or take the values from table "Product-Limit Survival Estimates" in the PROC LIFETEST output (or the corresponding output dataset if you specify the OUTSURV= option).

Example: For brand=a in your sample data you have t_{0}=0, t_{1}=231, t_{2}=390 and t_{3}=398. The corresponding KM-estimates are 1, 1, 0.5 and 0, respectively. The estimated mean survival time is then computed as

`1*(231-0)+1*(390-231)+0.5*(398-390)=394`

If the Kaplan-Meier curve (i.e. the KM-estimates) does not drop below 0.75 (0.5, 0.25), the first quartile (median, third quartile) cannot be estimated (as is the case for brand=b in your sample data). This is possible only if the largest survival time is censored.

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. **Registration is now open through August 30th**. Visit the SAS Hackathon homepage.

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.