Stata¶
Stata is a powerful general purpose package for data analysis and data management. Stata covers a wide range of statistical techniques. The package analyzes data quickly by reading all data into memory which may be managed dynamically during a session.
Interactive Mode¶
SSH onto the mercury login node with (optional) X11 forwarding
ssh -X <BoothID>@mercury.chicagobooth.edu
Request an interactive session on a compute node
srun --pty bash --login
Load the module with the desired version of Stata
module load stata/17.0
Start Stata by typing one of the following:
stata-se
for STATA Special Edition.stata-mp
for STATA Parallel Edition.xstata-se
for STATA Special Edition with X-Windowsxstata-mp
for STATA Multiprocessing with X-Windows
Batch Mode¶
To run Stata in batch mode, generate a submission script similar to the one below, and run by typing sbatch submit.sh
.
#!/bin/bash
#SBATCH --account=phd
#SBATCH --mem=1G
#SBATCH --time=0-01:00:00
#SBATCH --job-name=example_job
# Load the necessary software modules
module load stata/17.0
# create a new scratch directory for this job
scratch_dir="/scratch/${SLURM_JOB_USER}/${SLURM_JOB_ID}"
mkdir -p $scratch_dir
# use scratch dir to store tmp files
export STATATMP=$scratch_dir
# run script
dofile='program.do'
srun stata-se -b do $dofile
# remove scratch directory when done
rm -r $scratch_dir