## Plotting an adjusted -log(log survival) vs log(time) in survival analysis?

Solved
Occasional Contributor
Posts: 10

# Plotting an adjusted -log(log survival) vs log(time) in survival analysis?

Hello,

I am trying to see if non-proportionality exists for a cox proportional hazards model that is adjusted for multiple factors and is stratified by gender using a plot of -log(log survival) vs. log (time). I would like to include a plot in my final submission.

I know that I can't use "proc lifetest" because that can't adjust for other factors.  I am thinking that I might have to do something like the code below and then use proc gplot to graph log(-log survival) vs. log(time). How can I create the plot that I need?

proc phreg data=final;
model Survival_time*sensor(0)= Age BMI Smoking/ties=exact;
strata Gender;
Title "Cox proportional hazards model stratified by Gender";
baseline out=graph loglogs=llog survival=surv logsurv=lsur;  run;

proc gplot data=graph;

plot llog*(I DON'T KNOW HOW TO GET THE LOG TIME)=Gender

Accepted Solutions
Solution
‎04-17-2018 12:32 PM
Super User
Posts: 23,754

## Re: Plotting an adjusted -log(log survival) vs log(time) in survival analysis?

Calculate it manually in a step in between the procedures.

Also, you should likely use SGPLOT instead of GPLOT.

The documentation has the sample data for VALung here:

http://documentation.sas.com/api/docsets/statug/14.3/content/statug_code_phrex3.htm?locale=en

PHREG documentation here:

http://documentation.sas.com/?docsetId=statug&docsetTarget=statug_phreg_examples03.htm&docsetVersion...

``````*Survival model;
proc phreg data=VALung;
strata therapy;
class Prior(ref='no') Cell(ref='large') / param=ref;
model Time*Status(0)=Kps Duration Age Cell Prior;
baseline out=graph_data1 loglogs=llog survival=surv logsurv=lsur;
run;

*Calculate log of time;
data graph_data2;
set graph_data1;

if time=0 then
log_time=0;
*cannot take the log of 0;
else
log_time=log(time);
run;

*Graph results;
proc sgplot data=graph_data2;
series x=log_time y=lsur / group=therapy markers;
run;``````

@lousam wrote:

Hello,

I am trying to see if non-proportionality exists for a cox proportional hazards model that is adjusted for multiple factors and is stratified by gender using a plot of -log(log survival) vs. log (time). I would like to include a plot in my final submission.

I know that I can't use "proc lifetest" because that can't adjust for other factors.  I am thinking that I might have to do something like the code below and then use proc gplot to graph log(-log survival) vs. log(time). How can I create the plot that I need?

proc phreg data=final;
model Survival_time*sensor(0)= Age BMI Smoking/ties=exact;
strata Gender;
Title "Cox proportional hazards model stratified by Gender";
baseline out=graph loglogs=llog survival=surv logsurv=lsur;  run;

proc gplot data=graph;

plot llog*(I DON'T KNOW HOW TO GET THE LOG TIME)=Gender

All Replies
Solution
‎04-17-2018 12:32 PM
Super User
Posts: 23,754

## Re: Plotting an adjusted -log(log survival) vs log(time) in survival analysis?

Calculate it manually in a step in between the procedures.

Also, you should likely use SGPLOT instead of GPLOT.

The documentation has the sample data for VALung here:

http://documentation.sas.com/api/docsets/statug/14.3/content/statug_code_phrex3.htm?locale=en

PHREG documentation here:

http://documentation.sas.com/?docsetId=statug&docsetTarget=statug_phreg_examples03.htm&docsetVersion...

``````*Survival model;
proc phreg data=VALung;
strata therapy;
class Prior(ref='no') Cell(ref='large') / param=ref;
model Time*Status(0)=Kps Duration Age Cell Prior;
baseline out=graph_data1 loglogs=llog survival=surv logsurv=lsur;
run;

*Calculate log of time;
data graph_data2;
set graph_data1;

if time=0 then
log_time=0;
*cannot take the log of 0;
else
log_time=log(time);
run;

*Graph results;
proc sgplot data=graph_data2;
series x=log_time y=lsur / group=therapy markers;
run;``````

@lousam wrote:

Hello,

I am trying to see if non-proportionality exists for a cox proportional hazards model that is adjusted for multiple factors and is stratified by gender using a plot of -log(log survival) vs. log (time). I would like to include a plot in my final submission.

I know that I can't use "proc lifetest" because that can't adjust for other factors.  I am thinking that I might have to do something like the code below and then use proc gplot to graph log(-log survival) vs. log(time). How can I create the plot that I need?

proc phreg data=final;
model Survival_time*sensor(0)= Age BMI Smoking/ties=exact;
strata Gender;
Title "Cox proportional hazards model stratified by Gender";
baseline out=graph loglogs=llog survival=surv logsurv=lsur;  run;

proc gplot data=graph;

plot llog*(I DON'T KNOW HOW TO GET THE LOG TIME)=Gender