Hi all. According to -help limits-, the maximum size for a matrix in Stata is determined by matsize. But separately the documentation states that this can be circumvented by creating the matrix in Mata and then copying it into Stata using -st_matrix-, e.g., in the FAQ here: http://www.stata.com/support/faqs/ma...-than-matsize/.

I've been unable to find any mention of a limit to the size of a Stata matrix thus made. But trial-and-error suggests the maximum number of rows/columns is 32,767 (=2^15-1) since anything bigger generates a rather entertaining error, namely a negative number of rows or columns. For example:

I've checked this on a Windows 7 machine running Stata 10, 11 and 12 IC and Stata 13 SE.

Can someone verify that this is a genuine limit, and/or that it applies under other operating systems?

I've been unable to find any mention of a limit to the size of a Stata matrix thus made. But trial-and-error suggests the maximum number of rows/columns is 32,767 (=2^15-1) since anything bigger generates a rather entertaining error, namely a negative number of rows or columns. For example:

Code:

. mata: m=J(32767,1,1) . mata: st_matrix("m",m) . di rowsof(m) 32767 . . mata: m=J(32768,1,1) . mata: st_matrix("m",m) . di rowsof(m) -32768

Can someone verify that this is a genuine limit, and/or that it applies under other operating systems?

## Comment