I am trying to generate a new variable using the "if" command based on 3 other variables
ex:
gen completetx=1 if (neo==1 & surgery==1 & adjuvant==1)
However, it seems that stata only reads the first 2 conditions, and ignores the third. Am I doing something wrong? Is it possible to have more than 2 conditions with an if command? Thanks!
Related Posts with if command with 3 conditions
State Panel data - generating a year treatment variable with a month component?I have annual state panel data. Each state implemented a state reform at different times (year). I h…
Matching option expiration date with a date closest to earnings announcementDear stata users, How do I match options with expiration date closest to earnings announcement date…
David Roodman's xtabond2: why difference in no of observations between GMMdiff and GMMsysUsing the dataset abdata.dta I ran two commands, one with the noleveleq option and one without. The …
Saving F stat after RegressionHi All, I have data that resembles the following: Code: * Example generated by -dataex-. To in…
Keeping a list of observations using foreachCan foreach be used to keep a group of observations of a specific variable? I need to keep a group …
Subscribe to:
Post Comments (Atom)
0 Response to if command with 3 conditions
Post a Comment