Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: too many variables


From   "Sergiy Radyakin" <serjradyakin@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: too many variables
Date   Fri, 29 Aug 2008 15:32:22 -0400

Dear Austin,

thank you for taking time and writing the actual code. I have already
printed the errors list that it produces - excellent reference. But
some errors are not captured by the code however, e.g.:

assert 1==2
assertion is false
r(9);

This is probably because not all error codes have messages produced by
error(). In the example above, it is probably -assert- itself that
writes a message (display as error "assertion is false") and then
calls error(9). If I simply call error(9), I don't get the message. So
it is a little bit more complicated then that. A quick look at the
reference that Kit pointed to, and the output of the program resulted
in several of these discrepancies: 6, 7, 9, 170, 399, 409, 416, 420,
480, 482, 491 (stopped comparing at ~500)

Some messages have different wording , e.g. 106, 450, which does not
change the meaning however.

Error code 170 is said to work only for Unix and Mac. Indeed
error(170) does not generate a message, but -chdir nonsense- issues
this message in Stata for Windows: "unable to change to nonsense
r(170);" . It would be rather strange if no message appeared.

Interestingly, the program yielded some codes which are not documented
171-176, 403, 464-467

So it seems that both the printed manual and the results of Austin's
program are necessary to have a complete reference of Stata's error
codes.

Thank you,
   Sergiy Radyakin

On 8/29/08, Austin Nichols <austinnichols@gmail.com> wrote:
> Sergiy--
> Error codes above 9999 are probably safe, though Stata can reclaim or
> reassign error codes as they see fit--e.g. errors 3000-3999 pre- and
> post-Mata.  Note also that
>  version 5: error 3001
> does not recover old error codes!  It's safer to use an error code
> that Stata already assigns a message to, preferably one that seems
> unlikely to be reassigned (198 is safest).
>
> One can construct one's own list of predefined informative error codes
> for the current version like so:
>
> clear all
> prog errors
> tempfile e l
> tempname t
> file open `t' using `e', write replace
> forv i=1/9999 {
>  file write `t' _n "error `i'"
>  }
> file write `t' _n
> file close `t'
> cap log close
> cap log using `l', text
> do `e', nostop
> cap log close
> insheet using `l'
> end
> errors
> g err=real(substr(v1,9,.))
> g msg=v1[_n+1]
> drop if mi(err)
> drop if mi(msg)
> drop if substr(msg,1,2)=="r("
> drop if msg=="Mata run-time error"
> brow err msg
>
>
> On Fri, Aug 29, 2008 at 1:35 PM, Sergiy Radyakin <serjradyakin@gmail.com> wrote:
> > Thank you Kit, it's my fault.
> >
> > When I asked this question 4 weeks ago, nobody responded, so I assumed
> > this was true. http://www.stata.com/statalist/archive/2008-08/msg00154.html
> >
> > QUOTE:
> > "Which error codes are reserved for Stata use? Is there a full list of
> > these codes (and messages if possible)? Which codes may a Stata
> > programmer use for his/her own commands?"
> >
> > Regards, Sergiy
> >
> >
> >
> > On 8/29/08, Kit Baum <baum@bc.edu> wrote:
> >> < >
> >> Sergiy asserted
> >>
> >> Since Stata does not
> >> provide a list of all defined error codes, there is no easy way of
> >> knowing how to generate a particular error message.
> >>
> >> That annotated list appears in [P] error.
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index