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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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