Stata: Data Analysis and Statistical Software
   >> Home >> Resources & support >> FAQs >> Allocating memory in Stata

This FAQ is for Stata 11. It is not relevant for more recent versions.

Why do I get the error message "no room to add more observations"?

Title   Allocating memory in Stata
Author Jeremy B. Wernow, StataCorp
Date June 2000; minor revision March 2001

You need to allocate more memory to Stata. You can do this by typing set memory #, where # is the amount of memory you want to allocate.

        set memory 20000

or

        set memory 20m

Both commands will allocate 20 megabytes of memory.

There are two important considerations when deciding how much memory to allocate.

  1. Make sure that you allocate an amount of memory that is larger than the file that you are using. If your file is 30 megabytes, you may want to allocate 50 megabytes of memory to Stata. Stata will need the extra room to perform any commands or calculations. A good rule of thumb for large files is to allocate roughly 50% more memory than the size of your file. If you are using smaller files (< 10 megabytes), then allocating 15 megabytes on a PC with 128 megabytes of RAM is a good general guideline.
            set memory 15m 
  2. Make sure that you do not allocate too much memory because your computer will not have enough memory (RAM) left to perform other tasks. For example, if you only have 256 megabytes of RAM, then you should not allocate more than that. If you have a file that is larger than the amount of RAM installed on your computer, you will have to acquire more memory, work on a more powerful computer, or sacrifice speed by using virtual memory. See http://www.stata.com/support/faqs/data-management/using-large-dataset/ for more information about virtual memory and Stata.

To read more about memory usage in Stata, see appendix B in the Getting Started with Stata manual.

Bookmark and Share 
FAQs
What's new?
Statistics
Data management
Graphics
Programming Stata
Mata
Resources
Internet capabilities
Stata for Windows
Stata for Unix
Stata for Mac
Technical support
Like us on Facebook Follow us on Twitter Follow us on LinkedIn Google+ Watch us on YouTube
Follow us
© Copyright 1996–2013 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index   |   View mobile site