BookmarkSubscribeRSS Feed
CathyVI
Lapis Lazuli | Level 10

I am stocked with a KM estimated risk ratio, hazard ratio, adjusted hazard ratio. Is there a code to analyze this estimates in sas?

CathyVI_1-1642710906445.png

 

10 REPLIES 10
Reeza
Super User
Are you sure you're asking the correct question? Can you add more details as to what you're trying to do here?

tarheel13
Rhodochrosite | Level 12

I know you can get hazard ratio with proc phreg.

CathyVI
Lapis Lazuli | Level 10

@Reeza @tarheel13 

I got the Kaplan Meier estimated risk ratio (0.377) from the Product-Limit Survival Estimates of Treatment & placebo by dividing the failure rate of the treatment group by the failure rate of the placebo group and subtract the result from 1 i.e., (1-failure rate treatment / failure rate Placebo).

So my first questions is cant SAS do it for me without me manually doing the division and subtraction for the proportion? This is my code that produces the Product-Limit Survival Estimates.

 

proc lifetest data=a ;
time specimen*censor6(0);
strata pp/TEST;
run;

 

Second question is how do I calculate the p-value and confidence Interval just like in the table table, I have tried to add (TEST function for p-value of a homogeneity test specified in the STRATA statement but I didn't get it.

 

 
 
Reeza
Super User

https://gist.github.com/statgeek/d3bce2a9e2ef0523db9d

 

Do you have raw data and you're trying to calculate your ratios as in the first post?

 


@CathyVI wrote:

@Reeza @tarheel13 

I got the Kaplan Meier estimated risk ratio (0.377) from the Product-Limit Survival Estimates of Treatment & placebo by dividing the failure rate of the treatment group by the failure rate of the placebo group and subtract the result from 1 i.e., (1-failure rate treatment / failure rate Placebo).

So my first questions is cant SAS do it for me without me manually doing the division and subtraction for the proportion? This is my code that produces the Product-Limit Survival Estimates.

 

proc lifetest data=a ;
time specimen*censor6(0);
strata pp/TEST;
run;

 

Second question is how do I calculate the p-value and confidence Interval just like in the table table, I have tried to add (TEST function for p-value of a homogeneity test specified in the STRATA statement but I didn't get it.

 

 
 

 

CathyVI
Lapis Lazuli | Level 10

@Reeza Yes, I have a raw data but the GitHub link seems complicated for me. 

Reeza
Super User
Did you run it? You would need to modify where it saves the output, last parameter.
Run it, see if something in there is similar to what you need then figure out how you can call it for your data.
You're just changing the last line of code.
CathyVI
Lapis Lazuli | Level 10

@Reeza I don't want the CI in percent. I want the Confidence interval and p-value of the failure rate.

Reeza
Super User
"I got the Kaplan Meier estimated risk ratio (0.377) from the Product-Limit Survival Estimates of Treatment & placebo by dividing the failure rate of the treatment group by the failure rate of the placebo group and subtract the result from 1 "

I'm not familiar with that calculation so not sure how you'd go about getting a confidence interval for it to be honest.
CathyVI
Lapis Lazuli | Level 10

@Reeza I saw one of your previous comment online 

Solved: How to get confidence interval for failure rate in... - SAS Support Communities and maybe you can use this comment to help me.

In the table above, I wanted to calculate the Vaccine Efficacy(VE) 0.377 and its CI and P-value. This is the same dataset so i should get the same result.

I used the follow code to the get the failure rate, see table below. When I divided the failure rates(yellow highlighted) from each other I got 0.3590/0.5778 = 0.6213222568. 1-0.6213222568 = 0.3786

which i think is the same VE result they got. How do i get this result in sas without manually calculating it.

 

proc lifetest data=a ;
time specimenint*censor6(0);
strata pp;
run;

Thanks

pic1.pngpic2.pngpic3.png

 

 

 

 

Reeza
Super User
You can estimates for a specific time point. Was there something in the experimental design about the time point/end point? You would put that in the TIMELIST component to get estimates at that specific time point.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 10 replies
  • 2523 views
  • 1 like
  • 3 in conversation