BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
lousam
Obsidian | Level 7

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

 

I appreciate any help you can give me

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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

 

I appreciate any help you can give me


 

View solution in original post

1 REPLY 1
Reeza
Super User

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

 

I appreciate any help you can give me


 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 5753 views
  • 0 likes
  • 2 in conversation