Simple Cox regression with a binary x

Theoretical examples

Example 1
Suppose we are interested in the estimated effect of smoking (x) on mortality due to lung cancer (y) within a ten-year follow-up period. The failure event is death due to lung cancer (0=No event, 1=Event). Smoking status is coded as 0=Never smoked and 1=Ever smoked. The HR for ever-smokers is 2.73. This result suggests that, compared to never-smokers (the reference category), ever-smokers have a 2.73 times higher risk of dying. 
Example 2
We want to estimate the effect of sex (x) on all-cause mortality risk (y) among important characters during the first seven seasons of HBO’s popular television series, Game of Thrones. The failure event is death (0=No event, 1=Event). Sex is coded as 0=Male and 1=Female. The HR for females is 0.80, which indicates that, compared to males, important female characters have a 20% lower risk of dying during the first seven seasons.

Practical example

Dataset
StataData1.dta
Variable namecvd
Variable labelOut-patient care due to CVD (Ages 41-50, Year 2011-2020)
Value labels0=No
1=Yes
Variable namesex
Variable labelSex
Value labels0=Man
1=Woman

sum cvd sex if pop_cox==1

stcox sex if pop_cox==1, noshow
sts graph if pop_cox==1, survival ci noorigin ylabel(.90(0.01)1) xlabel(40(1)51) by(sex)

More information
help sts graph
sts test sex if pop_cox==1, noshow
More information
help sts test