The following two FAQs discuss using STATATMP to assign Stata temporary files (created by preserve or by using file names assigned by tempfile, among other possibilities) to a different location than the default. This is one way of resolving problems with inadequate space in the default location.
https://www.stata.com/support/faqs/d...ary-directory/
https://www.stata.com/support/faqs/d...ment-variable/
The discussion in the FAQs only indirectly addresses Stata on the Macintosh, which underneath the GUI is a Unix system. This post captures my current best attempt at explaining the Macintosh procedures in general, rather than in in the context of a longer discussion of problems.
Within Stata, the creturn list command tells us where Stata's system directories are located.
Note that the system directories direct you to the sysdir command, which gives advice on how to change their location. No similar command is built into Stata (as of version 15.1) for changing the location of tmpdir, the temporary directory. Instead, the most general method is to use the Terminal application to start Stata with the STATATMP environment variable set appropriately as part of the command.
In what follows, what you type is shown in red and what the Terminal or Stata types is shown in black.
https://www.stata.com/support/faqs/d...ary-directory/
https://www.stata.com/support/faqs/d...ment-variable/
The discussion in the FAQs only indirectly addresses Stata on the Macintosh, which underneath the GUI is a Unix system. This post captures my current best attempt at explaining the Macintosh procedures in general, rather than in in the context of a longer discussion of problems.
Within Stata, the creturn list command tells us where Stata's system directories are located.
Code:
. creturn list ... Directories and paths ---------------------------------------------------------------------------------------------- c(sysdir_stata) = "/Applications/Sta.." (sysdir) c(sysdir_base) = "/Applications/Sta.." (sysdir) c(sysdir_site) = "/Applications/Sta.." (sysdir) c(sysdir_plus) = "/Users/lisowskiw/.." (sysdir) c(sysdir_personal) = "/Users/lisowskiw/.." (sysdir) c(sysdir_oldplace) = "~/ado/" (sysdir) c(tmpdir) = "/var/folders/xr/l.." ---------------------------------------------------------------------------------------------- c(adopath) = "BASE;SITE;.;PERSO.." (adopath) c(pwd) = "/Users/lisowskiw/.." (cd) c(dirsep) = "/" ---------------------------------------------------------------------------------------------- ...
In what follows, what you type is shown in red and what the Terminal or Stata types is shown in black.
- Exit from Stata.
- Launch the Terminal application (it's in the Utilities folder in the Applications directory and in the Other box in Command Center).
- In the Terminal window that opens, the title bar at the top of the window should include something like "-bash" to indicate that the bash shell is running. If not, type the command "bash" as shown below. Don't worry if the prompts that Terminal responds with doesn't match the ones shown below.
Code:lisowskiw 1% bash bash-3.2$
- Type the command shown below, substituting the name of your hard drive for ExternalHD, which was the name I used for mine. Also, if you're running Stata MP you'll have to change StataSE to StataMP (I think, since I only have Stata SE myself).
Code:bash-3.2$ STATATMP="/Volumes/ExternalHD" open /Applications/Stata/StataSE.app/
- Stata will open. In the Stata command window, type the following command and review the output to confirm that the temporary directory is set to the path to your hard drive that you specified for STATATMP.
Code:. display c(tmpdir) /Volumes/ExternalHD
- When you quit Stata, return to the Terminal window and either re-launch Stata by using the up-arrow key to recall the command without having to retype it, or else quit the Terminal application, clicking "Terminate" if a confirmation dialog box appears.
Comment