Hello,
I have written the following code in Stata and I get a r(32) error (too many parentheses). I don't understand why, as I should need 9 closing parentheses as I have nine conditions?
Thanks much for your help
foreach year of local years {
generate state`year' = cond((poste`year' == "assistant" & rang`year' == "R1"), "state1", ///
cond((poste`year' == "assistant" & rang`year' == "R2"), "state2", ///
cond((poste‘year’ == “assistant” & rang‘year’ == “R3”), “state3” ///
cond((poste`year' == "associé" & rang`year' == "R1"), "state4", ///
cond((poste`year' == "associé" & rang`year' == "R2"), "state5", ///
cond((poste`year' == "associé" & rang`year' == "R3"), "state6", ///
cond((poste`year’ == "full" & rang`year' == "R1"), "state7", ///
cond((poste‘year’ == "full" & rang`year' == "R2"), "state8", ///
cond((poste`year' == "full" & rang`year' == "R3"), "state9", ///
"", "")))))))))
}
I have written the following code in Stata and I get a r(32) error (too many parentheses). I don't understand why, as I should need 9 closing parentheses as I have nine conditions?
Thanks much for your help
foreach year of local years {
generate state`year' = cond((poste`year' == "assistant" & rang`year' == "R1"), "state1", ///
cond((poste`year' == "assistant" & rang`year' == "R2"), "state2", ///
cond((poste‘year’ == “assistant” & rang‘year’ == “R3”), “state3” ///
cond((poste`year' == "associé" & rang`year' == "R1"), "state4", ///
cond((poste`year' == "associé" & rang`year' == "R2"), "state5", ///
cond((poste`year' == "associé" & rang`year' == "R3"), "state6", ///
cond((poste`year’ == "full" & rang`year' == "R1"), "state7", ///
cond((poste‘year’ == "full" & rang`year' == "R2"), "state8", ///
cond((poste`year' == "full" & rang`year' == "R3"), "state9", ///
"", "")))))))))
}
Comment