<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Proc lifetest mean calculation in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-lifetest-mean-calculation/m-p/644982#M30932</link>
    <description>&lt;P&gt;I have calculated the mean and median survival time from proc lifetest&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc lifetest data=graph2;
ods output means = mean_surv quartiles= median_surv;
time time*status(0);
strata brand;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;However I cannot understand how this is calculated.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the proc lifetest on have2 dataset and measure the mean and quartiles.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Q1what is the formula used for measuring this mean?&amp;nbsp;&lt;/P&gt;&lt;P&gt;.If I use the have2 dataset to measure mean time then I get a very different result. why is that?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Q2. why are quartiles missing for some brands?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 May 2020 13:20:31 GMT</pubDate>
    <dc:creator>riyaaora275</dc:creator>
    <dc:date>2020-05-04T13:20:31Z</dc:date>
    <item>
      <title>Proc lifetest mean calculation</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-lifetest-mean-calculation/m-p/644982#M30932</link>
      <description>&lt;P&gt;I have calculated the mean and median survival time from proc lifetest&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc lifetest data=graph2;
ods output means = mean_surv quartiles= median_surv;
time time*status(0);
strata brand;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;However I cannot understand how this is calculated.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the proc lifetest on have2 dataset and measure the mean and quartiles.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Q1what is the formula used for measuring this mean?&amp;nbsp;&lt;/P&gt;&lt;P&gt;.If I use the have2 dataset to measure mean time then I get a very different result. why is that?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Q2. why are quartiles missing for some brands?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2020 13:20:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-lifetest-mean-calculation/m-p/644982#M30932</guid>
      <dc:creator>riyaaora275</dc:creator>
      <dc:date>2020-05-04T13:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: Proc lifetest mean calculation</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-lifetest-mean-calculation/m-p/645024#M30935</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/183242"&gt;@riyaaora275&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can find the formulas for estimated mean and median survival time in &lt;SPAN&gt;section "&lt;/SPAN&gt;&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_lifetest_details03.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en" target="_blank" rel="nofollow noopener noreferrer"&gt;Breslow, Fleming-Harrington, and Kaplan-Meier Methods&lt;/A&gt;&lt;SPAN&gt;" of the PROC LIFETEST documentation. Both formulas&amp;nbsp;involve&amp;nbsp;&lt;EM&gt;Kaplan-Meier estimates&lt;/EM&gt;&amp;nbsp;(because you used the default,&amp;nbsp;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 &lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_lifetest_syntax01.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en#statug.lifetest.lftoutsurv" target="_blank" rel="noopener"&gt;OUTSURV= option&lt;/A&gt;).&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Example: For &lt;FONT face="courier new,courier"&gt;brand=a&lt;/FONT&gt; in your sample data you have t&lt;SUB&gt;0&lt;/SUB&gt;=0, t&lt;SUB&gt;1&lt;/SUB&gt;=231, t&lt;SUB&gt;2&lt;/SUB&gt;=390 and t&lt;SUB&gt;3&lt;/SUB&gt;=398. The corresponding KM-estimates are 1, 1, 0.5 and 0, respectively. The estimated mean survival time is then computed as&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;1*(231-0)+1*(390-231)+0.5*(398-390)=394&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;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 &lt;FONT face="courier new,courier"&gt;brand=b&lt;/FONT&gt; in your sample data). This is possible only if the largest survival time is censored.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2020 15:35:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-lifetest-mean-calculation/m-p/645024#M30935</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-05-04T15:35:43Z</dc:date>
    </item>
  </channel>
</rss>

