I am confused a bit with the if condition in the cases below. Can anyone explain to me why the two conditions below produce different results? What should I expect from the code in 1 and in 2?
Code:
gen dummy=0 replace dummy=1 if A!=0 & (B!=0 | C!=0) & (D!=0 | C!=0)
Code:
gen total=B+D gen dummy_test=0 replace dummy_test=1 if A!=0 & (total!=0 | C!=0)
0 Response to Basic question: stata condition
Post a Comment