Hello Ashim,
1. I don't think that the reason that you are getting "too many
variables" error message is lack of memory. In that case you should be
getting a different message (error 902 "no room to add more variables
due to width")
2. Make sure that the message is "too many variables" and not "too
many variables specified" or something else. There are many commands
that give very similar error messages (e.g. error code 103 gives "too
many variables specified" message). What is the error code?
3. If your "rule" involve any user-created commands - they may use
error codes defined according their own rules. E.g. Stata can tell you
that error 104 is "nothing to input", but the author of the command
might mean "parameter #4 is out of range". 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.
4. "width" is not the same as "number of variables". Width is
Sum(W[i], i=1..K), where K is the number of defined variables, and
W[i] is the width of i-th variable.
Type Width
byte 1
int 2
long 4
float 4
double 8
strW W
5. using compress should not have any effect if you've reached the
number of variables limit, because it only changes data type.
6. make sure you are not generating a bunch of dummies, e.g.
a-dummy-for-each-household for fixed effects.
7. try another "rule" and see if you get over your strange 200
variables limit. try to create 2000 variables.
8. Memory usage as defined by Steven earlier in this thread is true
only when all variables are str1 or byte, otherwise it is wrong.
number of observations must be multiplied by width of 1 observation
(see the above formula with sum() ) Overhead is typically 4,
somethimes 8 bytes. (in your case it is 4).
9. if your "rule" reshapes data from long to wide - the variables
limit can be hit quite
soon:http://www.stata.com/support/faqs/data/reshape.html
Regards,
Sergiy Radyakin
On 8/29/08, Steven Samuels <[email protected]> wrote:
> Ashim, someone from StataCorp would give you more technical details, but,
> very roughly speaking,
>
>
> memory usage = overhead + (#variables) x (#observations).
>
> The 2048 variable limit is a maximum possible, IF you have the memory
> available to handle them. You may not:
> If you try to add k new variables, you are increasing your memory usage by
> k x (# observations) and this could put you over the limit.
>
> Some solutions:
> 1. -compress-
> 2. -keep- only the variables you need for your analysis.
> 3. -drop- variables you previously created that you no longer need for this
> analysis (accomplishes same as 2. but may be shorter)
> 4. If not all observations are needed, keep only those you do need.
>
> A reminder: Maarten has asked you for the "exact" commands that you ran and
> the other details. You responded with a vague description about generating
> some variables. This was not helpful.
>
>
> -Steven
>
>
> On Aug 29, 2008, at 10:43 AM, Ashim Kapoor wrote:
>
> > Maarten,
> >
> > I generate variables according to some rule. I guess that trigerred
> > this when it could not add any more ?
> >
> > Thank you,
> > Ashim.
> >
> > On Fri, Aug 29, 2008 at 8:00 PM, Maarten buis <[email protected]>
> wrote:
> >
> > > --- Ashim Kapoor <[email protected]> wrote:
> > >
> > > > When I do -help limits- I can clearly see that the max no of
> > > > variables allowed in Stata IC which is what I am running is around
> > > > 2000.
> > > >
> > > > I only have about 200 variables and then it says too many variables.
> > > > I have set memory 1150m. Also is width = no of variables ?
> > > >
> > >
> > > What is the _exact_ command that triggered this message?
> > >
> > > -- Maarten
> > >
> > >
> > > -----------------------------------------
> > > Maarten L. Buis
> > > Department of Social Research Methodology
> > > Vrije Universiteit Amsterdam
> > > Boelelaan 1081
> > > 1081 HV Amsterdam
> > > The Netherlands
> > >
> > > visiting address:
> > > Buitenveldertselaan 3 (Metropolitan), room Z434
> > >
> > > +31 20 5986715
> > >
> > > http://home.fsw.vu.nl/m.buis/
> > > -----------------------------------------
> > >
> > > Send instant messages to your online friends
> http://uk.messenger.yahoo.com
> > > *
> > > * 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/
> >
>
> *
> * 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/