如果和语法错误

发布于 2025-01-27 03:44:00 字数 217 浏览 2 评论 0原文

我需要更改什么,以使二进制教育变量始终== 0对于此回归? “或”仅适用于场景

svy: reg binaryanswer1 i.scenario if scenario==5 | scenario==9 | scenario==12 | scenario==14 | scenario==15 & binaryeducation==0

What do I need to change so that the binaryeducationvariable 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温柔嚣张 2025-02-03 03:44:00

有关

help operator

操作员的优先级。我从来没有故意或偶然地记住这一点。如果操作员的顺序不是您想要的,请使用括号来执行不同的顺序。我认为您想要的是什么

if (scenario==5 | scenario==9 | scenario==12 | scenario==14 | scenario==15) & binaryeducation==0

,实际上,另一种设备可以更整洁地解决问题:

if inlist(scenario, 5, 9, 12, 14, 15) & binaryeducation == 0 

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 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文