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
Sum observations in different lines into one (by ID)Hello everyone, I'm trying to add observations in different lines into one line by ID. Below is t…
Plotting curves for hazard model with firm level stratificationDear all, I am running a stratified cox model on a firm-year dataset. The command i use is: stset y…
Shifting all the points down in a graph, to include main effect for interaction termsHi All, My dataset resembles the following: -------------------- copy starting from the next line …
Interactive fixed effectsDear All Is there any non-technical introduction to "Interactive fixed effects". Especially when it …
Matching cases and controls 1:5Hi, I would like to match cases and controls. I have got a variable saved as case where 1=case and …
Subscribe to:
Post Comments (Atom)
0 Response to if command with 3 conditions
Post a Comment