Stata

Stata is a general-purpose statistical software package that supports data manipulation, visualization, statistics, and automated reporting.

STATA 18 is now available on HPC, but only the STATA 18 SE version. The STATA 18 module will be updated if/when the MP version becomes available.

The Stata/MP batch job submission example and the GUI xstata-mp example will not work for Stata 18 at this time.

When running with the GUI for stata/18, only the xstata or xstata-se commands will work successfully.

Running Stata as batch Job

Stata/SE job submission

Here's an example as batch file that you can use to run Stata requesting 1 core using the Stata/SE: Standard edition command:

#!/bin/bash #SBATCH --ntasks=1 #SBATCH --partition=general module purge module load slurm stata/18 stata-se -b MyJob.do

This will run the Stata commands that you've placed in the file MyJob.do.

Stata/MP job submission (not available at this time)

Here's an example as batch file that you can use to run Stata requesting 1 core using the Stata/MP: Multiprocessor command:

#!/bin/bash #SBATCH --ntasks=1 #SBATCH --partition=general module purge module load slurm stata/18 stata-mp -b MyJob.do

Running Stata via its interactive GUI

The setup to running Stata through its interactive GUI has similar steps from our HPC X11/GUI guide located here:

https://kb.uconn.edu/space/SH/26033914267

Here is an example interactive SLURM srun command that can be used to request a 24 core interactive job using the AMD EPYC node architecture.

srun --x11 -N 1 -n 24 -p general --constraint='epyc128' --pty bash

Once a node is assigned to the interactive srun job, the stata/18 module would need to be loaded.

Once the module is loaded, the GUI for Stata SE or MP can be called with the following examples:

Stata-SE GUI load

netidhere@cnXX ~]$ (where XX is the compute node number assigned to the job) netidhere@cnXX ~]$ module load stata/18 netidhere@cnXX ~]$ xstata-se

Stata-MP GUI load (not available at this time)

Once the GUI loads, you will get a console like this.

 

When are done with Xstata, please exit the GUI and exit the interactive SLURM job if finished with running STATA code, to free up resources for others.

Installing and viewing Stata package information

In the Stata GUI, use the following commands to view and install STATA packages: 

Command 

Description of command 

ssc describe packageName 

Information output for a Stata package 

ssc install packageName 

Install Stata package indicated by packageName 

ssc install packageName, replace 

Same as above, but replace previously installed version of Stata package indicated by packageName 

ssc new 

See a summary of new and recently updated packages 

ssc hot 

See a summary of the 10 most popular Stata packages 

ssc hot, n(25) 

Same as above, but see the top 25 Stata packages 

ado dir 

Obtain a list of packages that you have previously installed