quietly: infile id site age male bkrace smoker estrogen prevdis diab2 bmi /// systBP aai cholest crp fib ttodth death cvddth /// using http://www.emersonstatistics.com/datasets/inflamm.txt drop in 1 summ ttodth if death==0 g deadin4= 0 replace deadin4= 1 if ttodth <= 4 * 365.25 recode crp 0=0 1/3=1 4/max=2, gen(crpCTG) recode crp 4/max=1 0/3=0, gen(crpGT3) g logcrp= log(crp) replace logcrp= log(0.5) if crp==0 table deadin4 if crp==. tabstat male age bmi smoker cholest prevdis deadin4, /// by(crpCTG) stat(n mean sd min q max) col(stat) long list bmi smoker cholest if crp!=. & crp==0 & (bmi==. | smoker==. | cholest==.) list bmi smoker cholest if crp!=. & crp>=1 & crp<=3 & (bmi==. | smoker==. | cholest==.) list bmi smoker cholest if crp!=. & crp>3 & (bmi==. | smoker==. | cholest==.) tabstat male age bmi smoker cholest crp prevdis if crp!=., /// by(deadin4) stat(n mean sd min q max) col(stat) long ttest crp, by(deadin4) unequal ttest crp, by(deadin4) ttest logcrp, by(deadin4) unequal di exp(.7078204), exp(1.088892), exp(.3810718), exp(.4757985), exp( .2863452) ttest logcrp, by(deadin4) di exp(.7078204), exp(1.088892), exp(.3810718), exp(.4689621), exp(.2931815) cs deadin4 crpGT3, or cc deadin4 crpGT3, exact g obsmos= ttodth / 30.4 stset obsmos death sts graph, by(crpGT3) ylabel(0.75(.05)1.00) /// plot1opts(lcolor(red)) plot2opts(lcolor(blue)) sts list, by(crpGT3) at(12 24 36 48 60) sts test crpGT3 stcox crpGT3, robust stcox crpGT3