cap program drop HypertensionPrevention_intervene
program define HypertensionPrevention_intervene
	syntax [varlist] [if] [in], cyr(integer)

* Hypertension Prevention Intervention
* Reduces the probability of having hypertension by the "ahibpe" factor

	marksample touse, zeroweight strok novarlist

	* Record Status before intervention
	cap drop old_hibpe
	gen old_hibpe = hibpe


	cap drop ltreat_now
	gen ltreat_now = treat_now
	replace ltreat_ever = treat_ever

	replace ltreat_hibpe = treat_hibpe
	replace ltreat_hibpe_evr = treat_hibpe_evr

	* Treat those who would have developed hypertension between 51 to 70 under status-quo
	replace treat_now = hbp_treat == 1 & died == 0 & lhibpe == 0
	replace treat_effective = 0  if `touse'


	replace treat_ever = 1 if treat_now == 1
	replace treat_hibpe_evr = 1 if treat_hibpe == 1
	replace treat_diabe_evr = 1 if treat_diabe == 1

	*** HYPERTENSION PREVENTION
	replace phibpe  = (phibpe) * ahibpe if treat_now
	gen hibpe_new  = hibpe
	replace hibpe_new = phibpe > normal(-x_hibpe`cyr') if treat_now
	replace treat_effective = 1 if hibpe == 1 & hibpe_new == 0 & treat_now
	replace hibpe = 0 if treat_effective
	drop hibpe_new


end