
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是一套提供其使用者数据分析、数据管理以及绘制专业图表的完整及整合性统计软件。该软件提供的功能包含线性混合模型、均衡重复反复及多项式普罗比模式。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)