<?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 How to obtain Pr(T &amp;gt; t) with PROC PLM in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/806200#M317605</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Given a cox regression model, as below, I would like to 'score'/assign model predictions to the dataset whas500 (or any other dataset). But I would like to do so in order to get predicted survival probabilities that is&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Pr(T&amp;gt;t)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;for any t. How do I alter PROC PLM in order to do so? or is there another way?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;the data set can be downloaded from here:&amp;nbsp;&lt;A href="https://stats.idre.ucla.edu/wp-content/uploads/2016/02/whas500.sas7bdat" target="_blank" rel="nofollow noopener noreferrer"&gt;https://stats.idre.ucla.edu/wp-content/uploads/2016/02/whas500.sas7bdat&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;libname a 'Dir where the SAS dataset resides';

   proc format library=work;
    value gender
          0 = "Male"
          1 = "Female";
    run;
    
    data whas500;
    set a.whas500;
    format gender gender.;
    run;
    
    
    proc phreg data = whas500;
    class gender;
    model lenfol*fstat(0) = gender age;;
    store work.s;
    run;
    
    
    proc plm restore=work.s;
       score data=whas500 out=testout predicted / ilink;
    run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 06 Apr 2022 07:12:02 GMT</pubDate>
    <dc:creator>Aleks1234</dc:creator>
    <dc:date>2022-04-06T07:12:02Z</dc:date>
    <item>
      <title>How to obtain Pr(T &gt; t) with PROC PLM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/806200#M317605</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Given a cox regression model, as below, I would like to 'score'/assign model predictions to the dataset whas500 (or any other dataset). But I would like to do so in order to get predicted survival probabilities that is&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Pr(T&amp;gt;t)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;for any t. How do I alter PROC PLM in order to do so? or is there another way?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;the data set can be downloaded from here:&amp;nbsp;&lt;A href="https://stats.idre.ucla.edu/wp-content/uploads/2016/02/whas500.sas7bdat" target="_blank" rel="nofollow noopener noreferrer"&gt;https://stats.idre.ucla.edu/wp-content/uploads/2016/02/whas500.sas7bdat&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;libname a 'Dir where the SAS dataset resides';

   proc format library=work;
    value gender
          0 = "Male"
          1 = "Female";
    run;
    
    data whas500;
    set a.whas500;
    format gender gender.;
    run;
    
    
    proc phreg data = whas500;
    class gender;
    model lenfol*fstat(0) = gender age;;
    store work.s;
    run;
    
    
    proc plm restore=work.s;
       score data=whas500 out=testout predicted / ilink;
    run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Apr 2022 07:12:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/806200#M317605</guid>
      <dc:creator>Aleks1234</dc:creator>
      <dc:date>2022-04-06T07:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to obtain Pr(T &gt; t) with PROC PLM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/806271#M317632</link>
      <description>&lt;P&gt;I suggest you use PROC UNIVARIATE on the predicted percentiles. By default, you get a table for the 99th, 95th, 90th, ..., 5th, 1th percentiles. You can also use the CDFPLOT statement to visualize the cumulative distribution, which is a nice way to visualize the results. Lastly, you can use the OUTPUT statement with the PCTLPTS= option to specify any value(s) of t. For example, the following writes an output data set that has estimates for the unit percentiles:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc univariate data=testout;
var Predicted;
cdfplot Predicted; /* visualize the percentiles */
ods select Quantiles CDFPlot;
output out=Pctls pctlpts=(0 to 100) pctlpre=P_;
run;

/* pctls in wide format */
proc print data=Pctls;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The output data is in the wide format. If you need it in the long format, you can transpose or you can use PROC STDIZE to get the long form directly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* pctls in long format */
proc stdize data=testout PctlMtd=ORD_STAT outstat=LongPctls
           pctlpts=(0 to 100);
var Predicted;
run;
 
proc print data=LongPctls(obs=10) noobs;
where _type_ =: 'P';
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Apr 2022 13:17:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/806271#M317632</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-04-06T13:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to obtain Pr(T &gt; t) with PROC PLM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/806272#M317633</link>
      <description>&lt;P&gt;I guess technically I showed how to get Pr(T &amp;lt;= t). You can subtract this result from 1 to get Pr(T &amp;gt; t).&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 13:19:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/806272#M317633</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-04-06T13:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to obtain Pr(T &gt; t) with PROC PLM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/807149#M318160</link>
      <description>&lt;P&gt;Hi Rick,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However the code below, does not produce probabilities, do you know why? and&amp;nbsp; how I can obtain those?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc plm restore=work.s;
score data=whas500 out=testout predicted / ilink;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 12:17:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/807149#M318160</guid>
      <dc:creator>Aleks1234</dc:creator>
      <dc:date>2022-04-11T12:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to obtain Pr(T &gt; t) with PROC PLM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/807153#M318161</link>
      <description>&lt;P&gt;Are there any error messages in the log? When I run your code on SAS 9.4M6, I get an output data set that contains predicted values:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=testout short varnum;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Contents: Varnum Short" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c b header" scope="col"&gt;Variables in Creation Order&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;ID AGE GENDER HR SYSBP DIASBP BMI CVD AFB SHO CHF AV3 MIORD MITYPE YEAR LOS DSTAT LENFOL FSTAT &lt;FONT color="#FF0000"&gt;Predicted&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can also use PROC PRINT:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=testout(obs=5);
var ID Gender Age lenfol Predicted;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.TESTOUT" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;ID&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;GENDER&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;AGE&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;LENFOL&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;Predicted&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;Male&lt;/TD&gt;
&lt;TD class="r data"&gt;83&lt;/TD&gt;
&lt;TD class="r data"&gt;2178&lt;/TD&gt;
&lt;TD class="r data"&gt;5.54666&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;TD class="r data"&gt;Male&lt;/TD&gt;
&lt;TD class="r data"&gt;49&lt;/TD&gt;
&lt;TD class="r data"&gt;2172&lt;/TD&gt;
&lt;TD class="r data"&gt;3.27453&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="r data"&gt;3&lt;/TD&gt;
&lt;TD class="r data"&gt;Female&lt;/TD&gt;
&lt;TD class="r data"&gt;70&lt;/TD&gt;
&lt;TD class="r data"&gt;2190&lt;/TD&gt;
&lt;TD class="r data"&gt;4.61235&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;4&lt;/TH&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;TD class="r data"&gt;Male&lt;/TD&gt;
&lt;TD class="r data"&gt;70&lt;/TD&gt;
&lt;TD class="r data"&gt;297&lt;/TD&gt;
&lt;TD class="r data"&gt;4.67790&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;5&lt;/TH&gt;
&lt;TD class="r data"&gt;5&lt;/TD&gt;
&lt;TD class="r data"&gt;Male&lt;/TD&gt;
&lt;TD class="r data"&gt;70&lt;/TD&gt;
&lt;TD class="r data"&gt;2131&lt;/TD&gt;
&lt;TD class="r data"&gt;4.67790&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suppose it is possible that you are running an old version of SAS that does not support some options. What does the log display when you submit&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;=SYSVLONG4;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 12:44:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/807153#M318161</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-04-11T12:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to obtain Pr(T &gt; t) with PROC PLM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/807155#M318163</link>
      <description>Hi,&lt;BR /&gt;Yes I get the same dataset , however I doubt these are probabilites 5.54? 3.27 or are they expressed in % ?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Apr 2022 12:51:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/807155#M318163</guid>
      <dc:creator>Aleks1234</dc:creator>
      <dc:date>2022-04-11T12:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to obtain Pr(T &gt; t) with PROC PLM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/807171#M318168</link>
      <description>&lt;P&gt;No. If you want the predicted probability of survival for each subject with a given combination of (age, Gender, Lenfol), then I think you should use the OUTPUT statement with the SURVIVAL keyword:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc phreg data = whas500;
   class gender;
   model lenfol*fstat(0) = gender age;
   output out=testout survival=PredSurv;
run;

proc sgplot data=testout;
   scatter x=Age y=PredSurv / group=Gender;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 13:57:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/807171#M318168</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-04-11T13:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to obtain Pr(T &gt; t) with PROC PLM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/807174#M318169</link>
      <description>ok, is this the survival probablities at what time?&lt;BR /&gt;&lt;BR /&gt;if I wish to score "new data" and obtain probability for survival at different times t= t_1,t_2,t_3 how do I choose these times?&lt;BR /&gt;&lt;BR /&gt;Do I need to run proc phreg with data=whas500 all the time to score new data ? can it be done independently of the data=whas500 ? in eg. a proc plm statement? which only depends on the parameter estimates and not the underlying data&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Apr 2022 14:19:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/807174#M318169</guid>
      <dc:creator>Aleks1234</dc:creator>
      <dc:date>2022-04-11T14:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to obtain Pr(T &gt; t) with PROC PLM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/807180#M318172</link>
      <description>&lt;P&gt;It is the predicted survival probability for the specified value of LENFOL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't understand what you are trying to accomplish, so please read the SAS doc for the following statements:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_022/statug/statug_phreg_syntax18.htm" target="_self"&gt;OUTPUT statement with the SURVIVAL keyword&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_022/statug/statug_phreg_syntax03.htm" target="_self"&gt;BASELINE statement with the COVARIATES= data set and the TIMEPOINT= option&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;The BASELINE statement gives a predicted survival curve for each patient:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc phreg data = whas500;
   class gender;
   model lenfol*fstat(0) = gender age;
   baseline covariates=whas500 out=outAll survival=PredSurv timepoint=0 to 50 by 5;
run;

proc sgplot data=outAll noautolegend;
   series x=LenFol y=PredSurv / group=ID lineattrs=GraphData1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 15:04:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-obtain-Pr-T-gt-t-with-PROC-PLM/m-p/807180#M318172</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-04-11T15:04:07Z</dc:date>
    </item>
  </channel>
</rss>

