User Tools

Site Tools


cluster:stata

Stata

Please contribute to this page by including any helpful tips or suggestions related to Stata or it's use on different operating systems.

Running Stata on the Cluster

The cluster contains v14 of both Stata/IC and Stata/MP. (To run your jobs using Stata/IC instead of Stata/MP, please use stata instead of stata-mp in all commands.). Version 13.1 of both stata/SE and stata/MP are also installed (see /usr/local/stata13/).

You can run the text-based interface of Stata interactively on the cluster with:

stata-mp

or if you have an setup X Forwarding (see also X-Windows server) then use (note xstata not available on all cluster machines)

 
xstata

You can also run a .do file in batch mode with

stata-mp -b do dofile.do

To allow your do-file to continue running when you log off from your terminal, preface the command with “nohup”. For example:

nohup stata-mp -b do dofile.do &

This is very useful because it means you don't have to keep your terminal or even your computer running - you can log off of the cluster, log off of the lab PC you're using, and then come back to the cluster when your job is done, even from another computer.

For more information on how to run your Stata command in the background, see Managing Jobs

Temporary Files

By default, Stata saves tempfiles (from -tempfile- or -preserve-) to /home/stata-tmp/. If you would like Stata to save temporary files in a new location (e.g. $HOME/statatmp) then from the command-line execute the follow before executing Stata:

export STATATMP=$HOME/statatmp 

One reason you might want to do this is that files are removed from /home/stata-tmp/ if they haven't been touched for a day. If you have a Stata process that runs for longer this may cause problems with reading from tempfiles or -restore-.

Package

Problem: Stata Doesn't have Outreg! On my home computer, I use outreg, estout, or other custom Stata commands. How do I install them on the cluster?

Solution: You install them the same way on the cluster as you initially did at home:

ssc install outreg

You will then have a folder installed within your home directory called “ado”, which contains your new commands filed away.

Tips from Students
  • Use the winexec (in Windows) or “!” as a prefix (in Unix/Linux) to execute the rest of the line as a shell command. Note that these don't work in “batch” mode on Windows.
cluster/stata.txt · Last modified: 2018/10/01 18:04 by mcloughlin