I am not at all familiar with Stata, but I do know how to calculate a hazard ratio using a frailty model in SAS:
'proc phreg' is for survival analysis and the 'random' statement introduces the frailty term (the ID or participant name
the option 'RL' requests the confidence intervals for the hazard ratio
with 'groupe' the treatment variable
the code will be:
proc phreg data=table;
class groupe id;
model time*Status(0)=groupe /RL ;
random id;
run;
In case you have other covariates (age gender...), the code will be (you want the adjusted hazard ratio for the variable 'groupe'):
proc phreg data=table;
class groupe id gender;
model time*Status(0)=groupe gender age/RL ;
random id;
hazardratio groupe;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.