<?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 Discrepancy Between Median Survival Time from Quartiles and Product Limit Estimates in PROC LIFETEST in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937774#M368454</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm encountering a discrepancy between the median survival times calculated using the quartiles method and the Kaplan-Meier product limit estimates in PROC LIFETEST. Here's a brief overview of my issue:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am analysing survival data using PROC LIFETEST&amp;nbsp; with the following SAS code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc lifetest data=adtte00 method=km conftype=LOGLOG plots=survival outsurv=survesti;
   time avalM * CNSR(1);
   strata trt; 
   by paramcd;
   ods output ProductLimitEstimates=KM_Estimates CensoredSummary=stat00 quartiles=med00 homtests=logrank00;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When I check the output, I notice that the median survival time from the &lt;CODE&gt;quartiles&lt;/CODE&gt; output (dataset &lt;CODE&gt;med00&lt;/CODE&gt;) does not match the median calculated from the Kaplan-Meier product limit estimates (dataset KM Estimates). Specifically:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Quartiles Output (med00) The median survival time is provided directly as the 50th percentile. (11.5811)&lt;/LI&gt;
&lt;LI&gt;Product Limit Estimates (KM Estimates) The closest time point where the survival probability crosses below 0.5 is used, leading to a slightly different median value. (11.3347)&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Here’s an example of the output I’m seeing:&lt;/P&gt;
&lt;P&gt;Quartiles Output:&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data med00;
    input Paramcd $ Stratum trt $ Percent Estimate Transform $ LowerLimit UpperLimit;
    datalines;
TTD 1 trt1 50 11.5811 LOGLOG 10.4148 14.7844
TTD 2 trt2 50 4.5010 LOGLOG 3.5483 5.9138
;
run;

proc print data=med00;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Product Limit Estimates:&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data KM_Estimates;
    input Paramcd $ Stratum trt $ avalm Censor Survival Failure StdErr Failed Left;
    datalines;
TTD 1 trt1 11.2361 0 0.5112 0.4888 0.0375 86 92
TTD 1 trt1 11.3018 0 0.5056 0.4944 0.0375 88 90
TTD 1 trt1 11.3347 0 0.5000 0.5000 0.0375 89 89
TTD 1 trt1 11.8275 0 0.4944 0.5056 0.0375 90 88
TTD 1 trt1 12.4189 0 0.4888 0.5112 0.0375 91 87
;
run;

proc print data=KM_Estimates;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;25         GOPTIONS ACCESSIBLE;
26         ods output ProductLimitEstimates=KM_Estimates CensoredSummary=stat00 quartiles=med00 homtests= logrank00;
27         proc lifetest data=adtte00 method= km conftype=LOGLOG plots=survival outsurv = survesti;
28            time avalM * CNSR(1);
29            strata trt;
30            by paramcd;
31         run;

NOTE: Graph's name, LIFETEST, changed to LIFETES5. LIFETEST is already used or not a valid SAS name.
NOTE: 19648 bytes written to 
      /saswork/SAS_workA34500001BB1_dsprgn05.ds-grid.com/SAS_workD3CA00001BB1_dsprgn05.ds-grid.com/lifetest5.png.
NOTE: The above message was for the following BY group:
      Parameter Code=TTD
NOTE: The data set WORK.LOGRANK00 has 3 observations and 5 variables.
NOTE: The data set WORK.MED00 has 6 observations and 8 variables.
NOTE: The data set WORK.STAT00 has 3 observations and 8 variables.
NOTE: The data set WORK.KM_ESTIMATES has 271 observations and 10 variables.
NOTE: The data set WORK.SURVESTI has 235 observations and 8 variables.
NOTE: PROCEDURE LIFETEST used (Total process time):
      real time           0.90 seconds
      cpu time            0.84 seconds&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why is there a discrepancy between the median survival times calculated using the quartiles method and the product limit estimates?. Are there specific steps I can take to ensure consistent median calculations between these methods?. Any insights or guidance on resolving this discrepancy would be greatly appreciated!&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>Wed, 31 Jul 2024 16:50:57 GMT</pubDate>
    <dc:creator>smackerz1988</dc:creator>
    <dc:date>2024-07-31T16:50:57Z</dc:date>
    <item>
      <title>Discrepancy Between Median Survival Time from Quartiles and Product Limit Estimates in PROC LIFETEST</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937774#M368454</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm encountering a discrepancy between the median survival times calculated using the quartiles method and the Kaplan-Meier product limit estimates in PROC LIFETEST. Here's a brief overview of my issue:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am analysing survival data using PROC LIFETEST&amp;nbsp; with the following SAS code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc lifetest data=adtte00 method=km conftype=LOGLOG plots=survival outsurv=survesti;
   time avalM * CNSR(1);
   strata trt; 
   by paramcd;
   ods output ProductLimitEstimates=KM_Estimates CensoredSummary=stat00 quartiles=med00 homtests=logrank00;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When I check the output, I notice that the median survival time from the &lt;CODE&gt;quartiles&lt;/CODE&gt; output (dataset &lt;CODE&gt;med00&lt;/CODE&gt;) does not match the median calculated from the Kaplan-Meier product limit estimates (dataset KM Estimates). Specifically:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Quartiles Output (med00) The median survival time is provided directly as the 50th percentile. (11.5811)&lt;/LI&gt;
&lt;LI&gt;Product Limit Estimates (KM Estimates) The closest time point where the survival probability crosses below 0.5 is used, leading to a slightly different median value. (11.3347)&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Here’s an example of the output I’m seeing:&lt;/P&gt;
&lt;P&gt;Quartiles Output:&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data med00;
    input Paramcd $ Stratum trt $ Percent Estimate Transform $ LowerLimit UpperLimit;
    datalines;
TTD 1 trt1 50 11.5811 LOGLOG 10.4148 14.7844
TTD 2 trt2 50 4.5010 LOGLOG 3.5483 5.9138
;
run;

proc print data=med00;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Product Limit Estimates:&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data KM_Estimates;
    input Paramcd $ Stratum trt $ avalm Censor Survival Failure StdErr Failed Left;
    datalines;
TTD 1 trt1 11.2361 0 0.5112 0.4888 0.0375 86 92
TTD 1 trt1 11.3018 0 0.5056 0.4944 0.0375 88 90
TTD 1 trt1 11.3347 0 0.5000 0.5000 0.0375 89 89
TTD 1 trt1 11.8275 0 0.4944 0.5056 0.0375 90 88
TTD 1 trt1 12.4189 0 0.4888 0.5112 0.0375 91 87
;
run;

proc print data=KM_Estimates;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;25         GOPTIONS ACCESSIBLE;
26         ods output ProductLimitEstimates=KM_Estimates CensoredSummary=stat00 quartiles=med00 homtests= logrank00;
27         proc lifetest data=adtte00 method= km conftype=LOGLOG plots=survival outsurv = survesti;
28            time avalM * CNSR(1);
29            strata trt;
30            by paramcd;
31         run;

NOTE: Graph's name, LIFETEST, changed to LIFETES5. LIFETEST is already used or not a valid SAS name.
NOTE: 19648 bytes written to 
      /saswork/SAS_workA34500001BB1_dsprgn05.ds-grid.com/SAS_workD3CA00001BB1_dsprgn05.ds-grid.com/lifetest5.png.
NOTE: The above message was for the following BY group:
      Parameter Code=TTD
NOTE: The data set WORK.LOGRANK00 has 3 observations and 5 variables.
NOTE: The data set WORK.MED00 has 6 observations and 8 variables.
NOTE: The data set WORK.STAT00 has 3 observations and 8 variables.
NOTE: The data set WORK.KM_ESTIMATES has 271 observations and 10 variables.
NOTE: The data set WORK.SURVESTI has 235 observations and 8 variables.
NOTE: PROCEDURE LIFETEST used (Total process time):
      real time           0.90 seconds
      cpu time            0.84 seconds&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why is there a discrepancy between the median survival times calculated using the quartiles method and the product limit estimates?. Are there specific steps I can take to ensure consistent median calculations between these methods?. Any insights or guidance on resolving this discrepancy would be greatly appreciated!&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>Wed, 31 Jul 2024 16:50:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937774#M368454</guid>
      <dc:creator>smackerz1988</dc:creator>
      <dc:date>2024-07-31T16:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: Discrepancy Between Median Survival Time from Quartiles and Product Limit Estimates in PROC LIFE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937784#M368456</link>
      <description>&lt;P&gt;Please share the LOG from running your Proc Lifetest code, include the code and any notes or messages generated.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 15:59:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937784#M368456</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-07-31T15:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Discrepancy Between Median Survival Time from Quartiles and Product Limit Estimates in PROC LIFE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937788#M368458</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp; Post Updated!.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 16:10:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937788#M368458</guid>
      <dc:creator>smackerz1988</dc:creator>
      <dc:date>2024-07-31T16:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Discrepancy Between Median Survival Time from Quartiles and Product Limit Estimates in PROC LIFE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937790#M368459</link>
      <description>What is the data point just prior to the 50% percentile on the KM_Estimates table? Being a step function I think it takes a less than, not less than or equal to calculation so it's likely the prior data point. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 31 Jul 2024 16:20:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937790#M368459</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-07-31T16:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Discrepancy Between Median Survival Time from Quartiles and Product Limit Estimates in PROC LIFE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937800#M368463</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp; I've updated KM_Estimates table for range of values around 50% percentile&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 16:52:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937800#M368463</guid>
      <dc:creator>smackerz1988</dc:creator>
      <dc:date>2024-07-31T16:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: Discrepancy Between Median Survival Time from Quartiles and Product Limit Estimates in PROC LIFE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937856#M368472</link>
      <description>You'd better post it at Stat Forum:&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/Statistical-Procedures/bd-p/statistical_procedures" target="_blank"&gt;https://communities.sas.com/t5/Statistical-Procedures/bd-p/statistical_procedures&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;My opinion is since these are two different ways to calculate median, you would not expect to get the same result.</description>
      <pubDate>Thu, 01 Aug 2024 02:42:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937856#M368472</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-08-01T02:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Discrepancy Between Median Survival Time from Quartiles and Product Limit Estimates in PROC LIFE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937900#M368477</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/430963"&gt;@smackerz1988&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/430963"&gt;@smackerz1988&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Why is there a discrepancy between the median survival times calculated using the quartiles method and the product limit estimates?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't see a discrepancy. Your &lt;FONT face="courier new,courier"&gt;KM_Estimates&lt;/FONT&gt; output shows that the 89th of the 178 survival times in stratum &lt;FONT face="courier new,courier"&gt;trt1&lt;/FONT&gt; is&amp;nbsp;&lt;FONT face="courier new,courier"&gt;11.3347&lt;/FONT&gt; and the 90th is&amp;nbsp;&lt;FONT face="courier new,courier"&gt;11.8275&lt;/FONT&gt;. Hence, all real numbers &lt;EM&gt;t&lt;/EM&gt; in the closed interval [&lt;FONT face="courier new,courier"&gt;11.3347&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;11.8275&lt;/FONT&gt;] qualify as "crude" (empirical) median survival times because the survival times of at least 50% (i.e., 89) of the subjects are ≤&lt;EM&gt;t&lt;/EM&gt; and the survival times of at least 50% of the subjects are ≥&lt;EM&gt;t&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this situation it is common to define the midpoint of that interval, (&lt;FONT face="courier new,courier"&gt;11.3347&lt;/FONT&gt;&amp;nbsp;+&amp;nbsp;&lt;FONT face="courier new,courier"&gt;11.8275&lt;/FONT&gt;)/2 = &lt;FONT face="courier new,courier"&gt;11.5811&lt;/FONT&gt; as the median (cf. the default &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p0v0y1on1hbxukn0zqgsp5ky8hc0.htm#n096sxke940tubn1mwmydr89jxdk" target="_blank" rel="noopener"&gt;QNTLDEF=5 option of PROC MEANS&lt;/A&gt;). This is analogous to what PROC LIFETEST does with the Kaplan-Meier estimates&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Ŝ&lt;/EM&gt;(&lt;EM&gt;t&lt;/EM&gt;)&lt;/STRONG&gt; of the survival function: see the example for the first quartile in section &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/statug/statug_lifetest_details03.htm" target="_blank" rel="noopener"&gt;Breslow, Fleming-Harrington, and Kaplan-Meier Methods&lt;/A&gt;&amp;nbsp;of the documentation, where it says: "If &lt;STRONG&gt;&lt;EM&gt;Ŝ&lt;/EM&gt;(&lt;EM&gt;t&lt;/EM&gt;)&lt;/STRONG&gt; is exactly equal to 0.75 from &lt;EM&gt;&lt;STRONG&gt;t&lt;SUB&gt;j&lt;/SUB&gt;&lt;/STRONG&gt;&lt;/EM&gt; to &lt;EM&gt;&lt;STRONG&gt;t&lt;SUB&gt;j+1&lt;/SUB&gt;&lt;/STRONG&gt;&lt;/EM&gt;, the first quartile is taken to be (&lt;EM&gt;&lt;STRONG&gt;t&lt;SUB&gt;j&lt;/SUB&gt;&lt;/STRONG&gt;&lt;/EM&gt; + &lt;EM&gt;&lt;STRONG&gt;t&lt;SUB&gt;j+1&lt;/SUB&gt;&lt;/STRONG&gt;&lt;/EM&gt;)/&lt;STRONG&gt;2&lt;/STRONG&gt;." Which explains why you got&amp;nbsp;&lt;FONT face="courier new,courier"&gt;11.5811&lt;/FONT&gt;&amp;nbsp;as the point estimate for the median in your &lt;FONT face="courier new,courier"&gt;quartiles&lt;/FONT&gt; output &lt;FONT face="courier new,courier"&gt;med00&lt;/FONT&gt;, given that&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Ŝ&lt;/EM&gt;(&lt;EM&gt;t&lt;/EM&gt;)&lt;/STRONG&gt; is exactly equal to 0.5 from&amp;nbsp;&lt;FONT face="courier new,courier"&gt;11.3347&lt;/FONT&gt;&amp;nbsp;to &lt;FONT face="courier new,courier"&gt;11.8275&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 11:09:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937900#M368477</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-08-01T11:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: Discrepancy Between Median Survival Time from Quartiles and Product Limit Estimates in PROC LIFE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937968#M368489</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 15:13:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Discrepancy-Between-Median-Survival-Time-from-Quartiles-and/m-p/937968#M368489</guid>
      <dc:creator>smackerz1988</dc:creator>
      <dc:date>2024-08-01T15:13:19Z</dc:date>
    </item>
  </channel>
</rss>

