How to use instrumental variable to estimate hazard ratios and 95% CI?


I am doing a Mendelian randomization analysis, by using an instrumental variable (Z, which is the genotype of exposure variable X), to investigate whether there is a causal association of genetically determined X on survival (Y). Suppose that Y includes information of both a dichotomized parameter “death” (0/1; 0: censor, 1: death) and a continuous parameter “time” (time to event). But unfortunately I do not know how to perform this analysis and get the hazard ratio and 95% confidence interval in Stata.

Could anyone tell me how to do it, please? I appreciate it very much for your expertise.

Best regards,