如何在Stata do文件编辑器中执行多行选择?
有谁知道如何使用Stata do-file编辑器中的“执行选择”功能来处理跨多行的代码? 目前我无法找到不使用 #delimit 来做到这一点的方法;需要重复“delimit ;”的系统在我想运行的每个块的开头。 任何建议表示赞赏!
Does anyone know how to use the "execute selection" function in the do-file editor of Stata for code that spans multiple lines?
Currently I can't find a way to do this without using the #delimit ; system which requires repeating "delimit ;" at the beginning of every block I want to run.
Any suggestions appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您可能错误地理解了
#delimit ;
命令:当您编写 do-file 并随后完整执行它时,这很有用。我还假设您使用的是 Stata 11,因为以前的版本的行为有所不同(例如,如果我没记错的话,Stata 10 SE for Mac 不支持//
注释和分隔)。如果您只执行代码的一小部分,请在一行末尾使用
///
来继续执行下一行的命令。基本示例(这将清除所有打开的数据,所以要小心):
即使您执行 sysuse 命令和 sc 命令(
scatter
),它也应该完美运行>) 单独命令。sc
命令在另一行上有mlab
选项(用于向数据点添加标签),但由于,这两行都将被解释为仅一个命令>///
指示。希望这有帮助!
I believe that you might be understanding the
#delimit ;
command wrongly: this is useful when you are coding a do-file to execute it in its entirety afterwards. I also assume that you are using Stata 11, since previous versions behave differently (if I recall well, Stata 10 SE for Mac does not support//
comments and delimiting, for example).If you are executing only a fraction of the code, use
///
at the end of a line to continue its command on the next one.Basic example (that will clear any open data, so beware):
This should run flawlessly even if you execute the
sysuse
command and thesc
(scatter
) commands separately. Thesc
command has themlab
option (to add labels to the data points) on a different line, but both lines will be interpreted as only one command due to the///
indication.Hope this helps!