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

Hi, All, I am running SAS program to compare survival curves of an variable with four groups. Surprisingly, Phreg returns survival curve opposite to Lifetest. Below are my code and graphs:

 

proc phreg data=plan plots(overlay)=(survival cumhaz) ;
class first_plan_type (ref='OTHER');
model life2*censor(0)=first_plan_type
/ties=breslow;
baseline covariates=plan out=Pred1 / diradj group=first_plan_type;
output out=outdata ressch= first_plan_type ;
run;

 

proc lifetest data=plan outtest=life_test1 PLOTS=(cb=hw test) maxtime =365 notable ;
time life2 * CENSOR (0);
strata first_plan_type ;
run;

 

Strangely, the graph created by phreg has "Other" group as the worst group and that from Lifetest shows "other" is the best group..The  Cox regression model results below confirms that of lifetest survival curves are correct. I am wondering what is wrong with phreg graphs of survival curves? Are they just labeled incorrectly? --Normally how do we label survival curves in phreg plots?

 

Analysis of Maximum Likelihood EstimatesParameter  
 
                                            DF Parameter Estimate Standard Error Chi-Square Pr > ChiSq Hazard Ratio Label
first_plan_typeCOMM10.071320.082450.74820.38701.074PLAN_TYPE COMM
first_plan_typeMDCD10.310370.177903.04370.08111.364PLAN_TYPE MDCD
first_plan_typeMDCR10.176850.077615.19220.02271.193PLAN_TYPE MDCR

 

 
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

@WillZh wrote:

Thank you, Reeza,

 

Are you suggesting me to run Nick's code with my own data or Nick's data? I don't have his data. In my prior posts, I provided my own data, log and results. My codes are simplified and almost the same as Nick's code. .


You need to run it with Rick's data. I suggest setting up a trial of SAS Academics on Demand, running your code in an actual SAS licensed environment and compare that with WPS.

View solution in original post

22 REPLIES 22
Reeza
Super User
Your data intersects quite a lot at the beginning so I'm guessing that the proportional hazards assumption for PROC PHREG are violated? Did you confirm that PH assumption is valid?

WillZh
Calcite | Level 5

Reeza,

 

Thank your reply...I added  test statement below:

 

  proportionality_test: test first_plan_type;

 

However, no results are returned(see below). The variable first_plan_type is NOT a time-dependent variable. What other statements can I add for assumption test?

 

Linear Hypothesis Testing Results  Label Wald Chi-Square DF Pr > Chi-Square 
#proportionality_test.0.

# indicates that the TEST statement contains effect variables that are not in the model or are null.

WillZh
Calcite | Level 5

In my results, the cox proportion regression parameter estimates give positive coefficients, which means that the groups increase hazard and reduce survival probabilities relative to the reference group ("OTHER"). However, in the chart, the survival curve for reference group is the lowest curve, which contradict to the model results...I do not understand why...

Rick_SAS
SAS Super FREQ

Without your data, I cannot reproduce what you see, Here is some sample data and two procedure calls. I get the same order for both procedures. If you can adapt this example to show what you are seeing, that would be helpful:

 

data bmt;
   set sashelp.bmt;
   where Group ne 'ALL';
   run;

ods graphics on;
ods select SurvivalPlot(persist);
proc phreg data=bmt plots=survival;
   class Group;
   model T*Status(0)=Group;
   baseline covariates=bmt / diradj group=Group;
   run;

proc lifetest data=bmt plots=survival;
   time T*Status(0);
   strata Group;
run;
WillZh
Calcite | Level 5

Thank you for your reply..Your codes are the same as what I posted. I had different chart for Phreg and Lifetable procedures too. Confusing!

I am attached my dataset here...so that you can take a look...

Reeza
Super User

What version of SAS/STAT are you using? Can you post the code, log and output from Ricks post?

 

If you need to find your SAS version:

proc product_status;run;

For this question, it would be what SAS/STAT version you're using. The most recent is 15.1 but that was released in the


@WillZh wrote:

Thank you for your reply..Your codes are the same as what I posted. I had different chart for Phreg and Lifetable procedures too. Confusing!

I am attached my dataset here...so that you can take a look...



past few months.

 

 

Reeza
Super User
Please don't edit your posts so far after the fact. If you have updates put it as a new response. It makes it really hard to follow a thread when you do this. The results shown do not match what I get, using exactly the data you provided. I'm running SAS 9.4 TS1M5, so almost the latest version.
WillZh
Calcite | Level 5

Reeza,  Just saw your message. Sorry to make some changes on the variable names....I have to remove sensitive information before I can share the dataset. But the results in question remain the same. The current group variable "type" has survival curves in phreg plots that contradicts with parameter estimate results and lifetable test plots.

Reeza
Super User

What version of SAS/STAT are you using? Can you post the code, log and output from Ricks post?

WillZh
Calcite | Level 5

Hi, Reeza,

 

Please find my attached log and results ...My codes are simplified based on Rick's codes. They are given below:

ods graphics on;
proc phreg data=PQSAS plots(overlay)=survival ;
class type (ref='OTHER') ;
ID ID;
model life2*censor(0)=type ;
baseline covariates=PQSAS /diradj group=type ;
run;

proc lifetest data=PQSAS PLOTS=survival notable ;
time life2 * CENSOR (0);
strata type ;

title 'Survival Analysis -- One group';

run;

WillZh
Calcite | Level 5

please note that in my prior post, the survival curves in Phreg plot are still opposite to its own parameter estimate results and lifetable plots. 

 

After I removed  diradj group=type, I cannot tell which curve is for which type in the plot as there is no label in the plot anymore.. that is an additional question-how to add label to survival curves without diradj statement?

Rick_SAS
SAS Super FREQ

Please let us know what version of SAS/STAT you are running. Reeza has requested this information several times.

WillZh
Calcite | Level 5

HI, Rick, 

 

I used WPS Version: 4.0.2.0.6753 with valid license.  All codes are the same as SAS codes. 

 

 

Rick_SAS
SAS Super FREQ

WPS is not SAS. It is a separate company that tries to emulate the syntax and functionality of SAS.

 

In other words, the software you are using is not created or supported by SAS. You need to contact their technical support and report this bug to them.  

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 22 replies
  • 5188 views
  • 7 likes
  • 3 in conversation