stata 编程里 开头的capture 是什么意思

stata 编程里 开头的capture 是什么意思,第1张

如果编程正确,capture不会显示什么特别结果,只是存贮一个0在_rc中,如果错误,就存个1在其中。但是有了capture,后面跟的命令就不会显示结果。如果需要显示后面命令的结果,就加上noisily,这时,如果程序正确就显示后面命令运行的结果,并且存个0在_rc中,否则显示错误信息,并存个0在_rc中。帮助有有说明的,你可以仔细看一下:

capture executes command, suppressing all its output (including error

messages, if any) and issues a return code of zero. The actual return

code generated by command is stored in the built-in scalar _rc.

capture can be combined with {} to produce capture blocks, which suppress

output for the block of commands. See the technical note in [P] capture

for more information.

capture is useful in do-files and programs because their execution

terminates when a command issues a nonzero return code. Preceding

sensitive commands with the word capture allows the do-file or program to

continue despite errors. Also do-files and programs can be made to

respond appropriately to any situation by conditioning their remaining

actions on the content of the scalar _rc.

capture can be combined with noisily to display the output and any error

messages regardless of the return code. For example,

. capture noisily regress y x

will either display an error message and store the return code in _rc or

display the output and store a return code of zero in _rc.

其实就是在运行一堆命令的时候,如果我用了Cap 即使我语句中有不小心那一句符号错误或者命令错误 那么那一句不执行,剩下其余的正常执行命令。如果不加cap的话,假设我第二句命令就出错了,那么我第二句往后所有的命令都执行不了。

Stata是一套提供其使用者数据分析、数据管理以及绘制专业图表的完整及整合性统计软件。该软件提供的功能包含线性混合模型、均衡重复反复及多项式普罗比模式。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/11502414.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-16
下一篇2023-05-16

发表评论

登录后才能评论

评论列表(0条)

    保存