{smcl}
{* *! version 1.1.3  10feb2011}{...}
{vieweralsosee "[P] capture" "mansection P capture"}{...}
{vieweralsosee "" "--"}{...}
{vieweralsosee "[P] break" "help break"}{...}
{vieweralsosee "[P] confirm" "help confirm"}{...}
{vieweralsosee "[P] quietly" "help quietly"}{...}
{viewerjumpto "Syntax" "capture##syntax"}{...}
{viewerjumpto "Description" "capture##description"}{...}
{viewerjumpto "Remarks" "capture##remarks"}{...}
{title:Title}

{p2colset 5 20 22 2}{...}
{p2col :{manlink P capture} {hline 2}}Capture return code{p_end}
{p2colreset}{...}


{marker syntax}{...}
{title:Syntax}

	{cmdab:cap:ture} [{cmd::}] {it:command}


        {cmdab:cap:ture} {cmd:{c -(}}
                {it:stata_commands} 
        {cmd:{c )-}}


{marker description}{...}
{title:Description}

{pstd}
{cmd:capture} executes {it:command}, suppressing all its output
(including error messages, if any) and issues a return code of zero.  The
actual return code generated by {it:command} is stored in the built-in
scalar {cmd:_rc}.

{pstd}
{cmd:capture} can be combined with {cmd:{c -(}}{cmd:{c )-}} to produce capture
blocks, which suppress output for the block of commands.  See the
{mansection P captureRemarkstechnote6:technical note} in {bf:[P] capture}
for more information.


{marker remarks}{...}
{title:Remarks}

{pstd}
{cmd: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 {cmd: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 {cmd:_rc}.

{pstd} 
{cmd:capture} can be combined with {cmd:noisily} to display the output and
any error messages regardless of the return code.  For example, 

{phang2}{cmd:. capture noisily regress y x} {p_end}

{pstd}
will either display an error message and store the return code in {cmd:_rc} or 
display the output and store a return code of zero in {cmd:_rc}.
{p_end}
