Differences between revisions 1 and 2
Revision 1 as of 2023-06-08 20:41:34
Size: 468
Comment:
Revision 2 as of 2025-10-24 16:39:20
Size: 507
Comment: Rewrite
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
The '''`capture`''' command runs commands while suppressing the output and capturing the return code. '''`-capture-`''' suppresses output and prevents errors from halting execution, but without overwriting the [[Stata/SystemVariables#Return_Code|return code]].
Line 20: Line 20:
to prevent output from being suppressed, try `capture noisily ...`. To un-suppress output, try `capture noisily ...`.

Stata Capture

-capture- suppresses output and prevents errors from halting execution, but without overwriting the return code.


Usage

capture assert errors==0
if (_rc!=0) {
  display "There are errors!"
}

To un-suppress output, try capture noisily ....


See also

Stata manual for capture


CategoryRicottone

Stata/Capture (last edited 2025-10-24 16:52:16 by DominicRicottone)