Stata

Software Category
Version
13mp, 15, 16, 16mp

Stata

Introduction

Stata is a software tool for performing statistical analysis of data. The Stata software is licensed and has been provided by the Department of Political Science.

Using Stata on RCC Resources

To use Stata, you must first load the module:

module load stata

To load a specific version of stata, specify it in the module load command:

module load stata/16
module load stata/16mp
module load stata/13mp

The Stata binaries are:

  • stata - the batch version of STATA
  • stata-mp - the batch multi-processor version of STATA
  • xstata - the gui version of STATA (Spear only)
  • xstata-mp - the gui multi-processor version of STATA (Spear only)

You can run Stata in three different ways:

  1. Interactive on the HPC Compute Nodes
  2. Batch jobs on the HPC Compute Nodes
  3. Interactive on the Spear Cluster (GUI or CLI)

Interactive on the HPC Compute Nodes

To use interactive mode on the HPC Compute Nodes, you will login into one of the compute nodes directly and type the stata commands just as you would on your computer. This is a good way for troubleshooting. However, you must stay logged in while your jobs are running. For long running jobs, we recommend using batch mode (see below).

For interactive use of STATA, use the following command on an HPC login node:

module load stata
srun --pty -t30:00 -n1 stata

This command will connect you to a node where STATA is installed.

Batch mode on the HPC

In batch mode, you submit your job to the system and it will run independently, like other HPC jobs. This is the preferred way of submitting large Stata jobs.

The following is an example of a batch job submission script (job.sh) that will run a Stat job via SLURM with a do-file called sample.do.

#!/bin/bash

#SBATCH -p stata_q
#SBATCH -J MYSTATAJOB

module load stata
stata -b do sample.do

If you save this file as job.sh, you can submit it using this command on your login node:

sbatch job.sh

Interactive on the Spear Cluster

The Spear nodes provide a good way to use GUI version of STATA. However, only short jobs are allowed to run on the Spear cluster.

To use the GUI version, login to Spear and run:

$xstata

or

$xstata-mp

Tips and tricks

Our statamp license supports up to 12 cores. To use the maximum number of cores in your job, use the following in your submit script:

#SBATCH -N 1
#SBATCH -n 12

Within the stata_q partition, you can run this command to determine how many CPUs are being used (it will print a number or blank if there are no CPUs in use):

squeue -h -o %C -p stata_q | awk '{cpus=cpus+$1} END { print cpus }'

For more information about Stata, refer to the official documentation: http://www.stata.com/support/documentation.