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)
0 Response to Problem with generating and replacing variable
Post a Comment