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?
first_plan_type | COMM | 1 | 0.07132 | 0.08245 | 0.7482 | 0.3870 | 1.074 | PLAN_TYPE COMM |
first_plan_type | MDCD | 1 | 0.31037 | 0.17790 | 3.0437 | 0.0811 | 1.364 | PLAN_TYPE MDCD |
first_plan_type | MDCR | 1 | 0.17685 | 0.07761 | 5.1922 | 0.0227 | 1.193 | PLAN_TYPE MDCR |
@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.
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?
# | proportionality_test | . | 0 | . |
# indicates that the TEST statement contains effect variables that are not in the model or are null.
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...
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;
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...
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, 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.
What version of SAS/STAT are you using? Can you post the code, log and output from Ricks post?
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;
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?
Please let us know what version of SAS/STAT you are running. Reeza has requested this information several times.
HI, Rick,
I used WPS Version: 4.0.2.0.6753 with valid license. All codes are the same as SAS codes.
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.
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!
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.