>> Home >> Resources & support >> FAQs >> Using the STATATMP environment variable

Why am I getting an error message that there is “insufficient disk space”?

Title   Using the STATATMP environment variable
Author Pete Huckelba, StataCorp
Date February 2003; updated December 2006

Some routines within Stata will use the preserve and restore commands or will attempt to write temporary files to aid in processing. If your machine is limited in hard-drive space, or if the partition is near its capacity, Stata may report an error similar to

        insufficient disk space

By default, Stata will save temporary files in the directory pointed to by the TEMP (Windows) or TMPDIR (Linux/Unix) environment variable. You also have the option of setting up the environment variable, STATATMP, to point to a location other than the predefined variables listed above. The usage of STATATMP is preferred because some operating systems may not allow you to modify the path of TEMP or TEMPDIR unless you have administrative or root access.

If your machine has free space on another physical drive or partition, you can instruct Stata to save its files to that location to prevent the error. Depending on the method used, you will have to terminate the current Stata session and may have to log out or reboot the machine.

To verify the location of the temporary directory Stata is using, type the following commands from within Stata:

        . tempfile junk
        . display "`junk'"

Ignore the filename and look at the directory—this is where Stata is saving temporary files. Using your operating system's tools, you can verify if that location is actually near its limit.

Temporary fix

Using your favorite editor, create a file with the following contents:

Permanent Fix

Note: Both of the methods listed above require that the directory exists before attempting to set the environment variable.





The Stata Blog: Not Elsewhere Classified Find us on Facebook Follow us on Twitter LinkedIn Google+ YouTube
© Copyright 1996–2016 StataCorp LP   •   Terms of use   •   Privacy   •   Contact us