---
title: "Stata"
canonical: "https://kb.uconn.edu/space/SH/26033946992/Stata"
format: markdown
---
Stata is a general-purpose statistical *software* package that supports data manipulation, visualization, statistics, and automated reporting.

> 📝 STATA 19 is now available on HPC, but only the STATA 19 SE version. 
> 📝 
> 📝 The MP version of STATA will not be available at this time due to the MP license having a limited number of cores allowed.

## 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 stata

 stata-se -b MyJob.do

```

This will run the Stata commands that you've placed in the file [MyJob.do](http://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](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/19
netidhere@cnXX ~]$ xstata-se
```

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

![Stata19Snip.png](media://2a41f1dd-d343-465f-b650-5875df6d6c0b)


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 |