Hi
Thank you for your inputs and helps on this topic.
I was able to run the proc lifetest and phreg but confused, which datasets need to be used to get the information since outputs produces so much information . I need to get the following information. I was providing dataset I have.
/* Create the original dataset */
*Information in data
AVAL ->Number of Days after the Treatment that Adverse Event Occurred"
CNSR-> If the event occurred, then CNSR =0 otherwise, 1
ARM-> IND and Placebo;
data have;
input USUBJID ARM AVAL CNSR;
datalines;
1 1 1 1
2 1 2 0
3 1 10 1
4 2 5 1
5 2 6 0
6 2 8 1
7 2 10 0
8 2 11 0
9 1 12 1
10 2 13 1
11 2 15 1
12 1 10 0
13 1 18 1
14 2 19 0
15 2 21 1
16 1 23 1
17 1 5 1
18 2 25 1
;
run;
data have;
set have;
if arm = 1 the TRT = 'Placebo';
if arm =2 then TRT = 'IND';
run;
** for Quartiles and estimates/ Not using any from Estimates data**
proc lifetest method=KM data=have plots=none;*timelist=(5,10,15);
strata arm;
time aval*cnsr(1);
ods output productlimitestimates = estimates
Quartiles = quart;
run;
** for HR and 95 %CI/ Not sure where to get P- value**;
proc phreg data=have;
class arm (ref='2');
model aval*cnsr(1) = arm / risklimits ties=efron rl;
hazardratio arm / diff=ref;
ods output ParameterEstimates = hR;
run;
*** for adverse event free probability and 95% CI at day 10**;
proc lifetest method=KM data=have plots=none timelist=(5,10,15);
strata arm;
time aval*cnsr(1);
ods output productlimitestimates = estiTime;
run;
From PHREG: Cox Model
1 . Probability (IND Vs Placebo) - P-value
2. Hazard Ratio (IND Vs Placebo)
3 . 95% CI (IND Vs Placebo)
From PROC LIFETEST:
Quartiles:
1. Q1 with 95%CI
2. Q3 with 95% CI
3. Median with 95% CI
From PROC LIFETEST:
Adverse Event Free probability at Day 10
** for HR and 95 %CI/ Not sure where to get P- value**;
proc phreg data=have;
class arm (ref='2');
model aval*cnsr(1) = arm / risklimits ties=efron rl;
hazardratio arm / diff=ref;
ods output ParameterEstimates = hR;
run;
There four way to get P-Value:
1)
proc phreg data=have; class arm (ref='2')/param=glm; model aval*cnsr(1) = arm / risklimits ties=efron rl; hazardratio arm / diff=ref; ods output ParameterEstimates = hR; run;
2)
proc phreg data=have; class arm (ref='2')/param=glm; model aval*cnsr(1) = arm / risklimits ties=efron rl; hazardratio arm / diff=ref; ods output ParameterEstimates = hR; estimate 'arm1 vs arm2' arm 1 -1/exp cl; /* lsmeans arm/diff exp cl;*/ run;
3)
proc phreg data=have; class arm (ref='2')/param=glm; model aval*cnsr(1) = arm / risklimits ties=efron rl; hazardratio arm / diff=ref; ods output ParameterEstimates = hR; /* estimate 'arm1 vs arm2' arm 1 -1/exp cl;*/ lsmeans arm/diff exp cl; run;
4)
proc phreg data=have; class arm (ref='2')/param=glm; model aval*cnsr(1) = arm / risklimits ties=efron rl; hazardratio arm / diff=ref; ods output ParameterEstimates = hR; lsmestimate arm 'arm1 vs arm2' 1 -1/exp cl; run;
/*****************************************************************************/
*** for adverse event free probability and 95% CI at day 10**; proc lifetest method=KM data=have outs=outs plots=none timelist=(5,10,15); strata arm; time aval*cnsr(1); ods output productlimitestimates = estiTime; run; proc sql; create table temp as select distinct arm,10 as aval from have; quit; data want; set outs temp; by arm aval; run; data want; set want; by arm; retain point lower upper; if first.arm then call missing(point, lower, upper) ; if not missing(SURVIVAL) then point=SURVIVAL; if not missing(SDF_LCL) then lower=SDF_LCL; if not missing(SDF_UCL) then upper=SDF_UCL; run; proc sql ; select distinct aval, arm,point,lower,upper from want where aval=10; quit;
I don't know much about quartile estimates from PROC LIFETEST, but for your PHREG question, you need to set ref='1' to get the HR for IND vs. placebo. The way you currently have it has IND set as the ref - this is not what you want. As for the p-value, it's just the thing in the parameter estimates output labeled "Pr > ChiSq". In this case, you do NOT need the HAZARDRATIO statement.
For the LIFETEST question about AE-free survival at day 10 - you can get this from the column labeled SURVIVAL in your output dataset (EstiTime) -- i.e., survival at day 10. When I run your code, I get 68.57% for ARM 1 and 76.19% for ARM 2.
Good luck.
Thank you very much for your inputs.
** for HR and 95 %CI/ Not sure where to get P- value**;
proc phreg data=have;
class arm (ref='2');
model aval*cnsr(1) = arm / risklimits ties=efron rl;
hazardratio arm / diff=ref;
ods output ParameterEstimates = hR;
run;
There four way to get P-Value:
1)
proc phreg data=have; class arm (ref='2')/param=glm; model aval*cnsr(1) = arm / risklimits ties=efron rl; hazardratio arm / diff=ref; ods output ParameterEstimates = hR; run;
2)
proc phreg data=have; class arm (ref='2')/param=glm; model aval*cnsr(1) = arm / risklimits ties=efron rl; hazardratio arm / diff=ref; ods output ParameterEstimates = hR; estimate 'arm1 vs arm2' arm 1 -1/exp cl; /* lsmeans arm/diff exp cl;*/ run;
3)
proc phreg data=have; class arm (ref='2')/param=glm; model aval*cnsr(1) = arm / risklimits ties=efron rl; hazardratio arm / diff=ref; ods output ParameterEstimates = hR; /* estimate 'arm1 vs arm2' arm 1 -1/exp cl;*/ lsmeans arm/diff exp cl; run;
4)
proc phreg data=have; class arm (ref='2')/param=glm; model aval*cnsr(1) = arm / risklimits ties=efron rl; hazardratio arm / diff=ref; ods output ParameterEstimates = hR; lsmestimate arm 'arm1 vs arm2' 1 -1/exp cl; run;
/*****************************************************************************/
*** for adverse event free probability and 95% CI at day 10**; proc lifetest method=KM data=have outs=outs plots=none timelist=(5,10,15); strata arm; time aval*cnsr(1); ods output productlimitestimates = estiTime; run; proc sql; create table temp as select distinct arm,10 as aval from have; quit; data want; set outs temp; by arm aval; run; data want; set want; by arm; retain point lower upper; if first.arm then call missing(point, lower, upper) ; if not missing(SURVIVAL) then point=SURVIVAL; if not missing(SDF_LCL) then lower=SDF_LCL; if not missing(SDF_UCL) then upper=SDF_UCL; run; proc sql ; select distinct aval, arm,point,lower,upper from want where aval=10; quit;
Thank you very much @Ksharp for your detailed Response.
I think I got 95% of what I wanted. However, I have questions regarding choosing which variable in Proc life test estimates. This is for my education, and I always read it, but I need to remember it.
In my data, If Adverse events occur, I was given CNSR =0; otherwise, it's 1.
When we run the proc life test, we get variables 'SURVIVAL' and sometimes "FAILURE' ( depending on the code).
My question is in this Scenario:
'Survival' Variable indicates the Adverse Event Free Probability or Probability of an Adverse Event can happen? because in some places we used to see "1- SURVIVAL"
Thanks, you are correct, I changed in my program, forgot to mention in the msg.
"If Adverse events occur, I was given CNSR =0; otherwise, it's 1."
So the "interesting" thing in survivial analysis is "Adverse events", the censored flag is 1 (the "interesting" thing not happened), therefore the following statement is right:
time aval*cnsr(1);
'Survival' Variable is the survival probability(a.k.a the probability of "interesting" thing not happened),
I think it should be "Adverse Event Free Probability" (I am not familiar with concept of Free Probability).
"Probability of an Adverse Event can happen"
I think it should be Failure Probability, you could get this by the following code:
data have;
input USUBJID ARM AVAL CNSR;
datalines;
1 1 1 1
2 1 2 0
3 1 10 1
4 2 5 1
5 2 6 0
6 2 8 1
7 2 10 0
8 2 11 0
9 1 12 1
10 2 13 1
11 2 15 1
12 1 10 0
13 1 18 1
14 2 19 0
15 2 21 1
16 1 23 1
17 1 5 1
18 2 25 1
;
run;
proc lifetest data=have plots=survival(failure atrisk=5 to 15 by 5);;
strata arm;
time aval*cnsr(1);
run;
Thank you for your explanation. I think I got a better picture now.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.