[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: proceeding beyond roctab 2000 error msg - correction
You're right. I have always assumed that the error code shown after an
error is put in _rc, but it isn't -- you learn something new every day.
This explains some previous wondering on my part when I find nonzero return
codes after executing ados that ran without an error. I now realize that
these were captured inside the ado -- a potentially confusing feature when
you see a nonzero _rc after running the ado because of a line like -cap
confirm string var xxx -.
----- Original Message -----
From: "Gary Longton" <email@example.com>
Sent: Tuesday, June 01, 2004 6:08 PM
Subject: Re: st: proceeding beyond roctab 2000 error msg - correction
> David Kantor wrote:
> >>I might add that it is important to know that _rc is set only for a
> >> command that occurs under -capture-.
> >>If you want to see the output of the command AND subsequently test _rc,
> >>then do...
> >> capture noisily ...
> and Michael Blasnik replied:
> > I may be misunderstanding your first sentence, but _rc is set by every
> > command in Stata, whether you use -capture- or not. It's just
> > that -capture- (quite appropriately named) captures the error code so
> > Stata does not stop processing the current do/ado file.
> I think that David was actually correct: _rc is a system scalar holding
> return code from the most recent -capture- command. See [U]16.4 or
> yourself by displaying (-display _rc-) after any erroneous Stata command
> without -capture-.
> Though a Stata command may return a variety of error codes, the code will
> "captured" in the scalar _rc unless -capture- precedes that command.
> - Gary
* For searches and help try: