Reputation: 11
What do I need to change so that the binaryeducation
variable always==0 for this regression? The "or" should only be for the scenarios
svy: reg binaryanswer1 i.scenario if scenario==5 | scenario==9 | scenario==12 | scenario==14 | scenario==15 & binaryeducation==0
Upvotes: 1
Views: 22
Reputation: 37208
See
help operator
for the precedence of operators. I have never memorised this either on purpose or by accident. If the order of operators is not what you want, use parentheses to enforce a different order. I think what you want is
if (scenario==5 | scenario==9 | scenario==12 | scenario==14 | scenario==15) & binaryeducation==0
and indeed another device would solve the problem more neatly:
if inlist(scenario, 5, 9, 12, 14, 15) & binaryeducation == 0
Upvotes: 1