Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Outreg2 error "matrix __000009 not found"


From   Steffen Nauhaus <snauhaus@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Outreg2 error "matrix __000009 not found"
Date   Thu, 14 Feb 2013 00:20:58 +0100

Dear Stata listers,

I'm having trouble with what should actually be a relatively simple piece of code. With the loop below I was planning to store AIC and BIC values to an outreg table. The code works perfectly fine, until the "noconstant" option is added to the regression (line 3).

----------

	local p dy0 //get AIC BIC
forvalues d=1/7 {
	quietly regress `p', noconstant
	estat ic
	matrix OUT = r(S) //store matrix
	local AIC =  OUT[1,5] //store AIC
	local BIC = OUT[1,6] //store BIC
	outreg2 using temp.tex, append tex(fragment) ///
		addstat(AIC, `AIC', BIC, `BIC') 
	local p = "`p' dy`d'"
}

! mv "./temp.tex" "./2ay.tex" /*rename temp.tex to 2a.tex
							may not work outside unix
							overwrites existing 2a.tex
							*/
! rm -r "./temp.txt"

----------

With "[...], noconstant" specified, the code returns the error "matrix __000009 not found". The same happens when running all the lines individually. The code, however, works without issues when the noconstant option is omitted. 

I am not sure whether this is a bug or if I am overlooking something. I really hope someone can find what's the problem here.

Thanks and cheers,
Steffen
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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