Hi,

I have written the following code but I am facing a lot of problems.

Code:
gen tetns_inj=.
 replace tetns_inj=1 if (Tetns_inj_before_birth==0 | Tetns_inj_before_birth==8)
replace tetns_inj=1 if (tetns_inj==.) & (Tetns_inj_before_preg==0 | Tetns_inj_before_preg==8)

Alternatively,
Code:
gen tetns_inj=1 if (Tetns_inj_before_birth==0 | Tetns_inj_before_birth==8) | ( Tetns_inj_before_preg==0 |  Tetns_inj_before_preg==8)
Each time i get the result shown in the picture. Line number 44 should have . in the first column. Instead there is a 1.