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

Re: st: too many variables

From   "Austin Nichols" <>
Subject   Re: st: too many variables
Date   Fri, 29 Aug 2008 14:06:32 -0400

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'
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 <> wrote:
> Thank you Kit, it's my fault.
> When I asked this question 4 weeks ago, nobody responded, so I assumed
> this was true.
> "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 <> 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:

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