Statalist The Stata Listserver

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

st: RE: tabstatmat - too many literals r(130);

From   "Nick Cox" <>
To   <>
Subject   st: RE: tabstatmat - too many literals r(130);
Date   Thu, 18 May 2006 12:45:49 +0100

You are right. -tabstatmat- can trigger this official limit
of Stata. 

But your question exposes what you are doing. You are in
effect asking -tabstat- to produce 303 matrices (perhaps
more, depending on details) and then using -tabstatmat- as a
clean-up program to put them all together again. That asking
may not be conscious, because the operations are hidden in
the code. But there should be another way of getting where
you want to be more directly. 

I could, no doubt should, work at -tabstatmat- to see if
this limit can be overcome. I suspect it can, but in the
first instance let us see whether there are other tools for
what you want. 

-tabstat- is in essence a tabulation program and an
excellent one. I use it a lot. However, only rather
awkwardly does it serve as a data reduction program. A data
reduction program I define as one that maps some or all of
your dataset to a new dataset that you want to manipulate in
turn. -collapse- and -contract- are examples. The main
reason for saying that about -tabstat- flows from its being
sufficiently general to produce not just tables that are
equivalent to matrices, strict sense, but also tables that
are sets of matrices. So, its returned objects are set up to
match this generality. It leaves behind a set of matrices. 

-tabstatmat- arose as a response to a Statalist question
from Friedrich Huebler who wanted to put together the
returned objects.  I posted a program to do it. But it's
written in the spirit of "If you find yourself in the middle
of a bog, here is a way out." Other advice might be "Don't
wander into the middle of a bog. Keep to dry ground!" I use
-tabstatmat- myself largely when I am fixing its bugs that
users have found. 

More prosaically, and more generally: 

You want a matrix. Why? Is it because you want do something
with it that depends on it being a matrix, such as adding it
to another matrix, or getting some eigenvalues? Or is the
matrix just a means to an end, such as exporting a reduced
dataset to other software? 

If you want a matrix of descriptive statistics, qua matrix,
there are plenty of other programs designed to do that
directly. One example is -statsmat- from SSC. 

If you want an output dataset, or an output table, then
again there are better programs for that, such as
-collapse-, -contract-, -tabout- from SSC or even
-tabexport- from SSC. 

More advice depends on more details. 


Ada Ma
> Hello Statalist (and Nick Cox in particular being the author 
> of tabstatmat),
> I tried to save the results of tabstat in a matrix using tabstatmat.
> However it seems like the table I made got too many rows (303 in my
> case), and I ran into the too many parantheses error (255 is the max
> according to the error code).
> What would you recommend me to do in this case?  I think I can do the
> tabstat by the 100's, and then stack the matrices.  Is there any thing
> else you'd recommend?

*   For searches and help try:

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