Stata

Description

Stata is a licensed statistical software package. We have a 4-core license for Stata 17 on the cluster. The current license is specifically for this version of Stata, so we cannot provide newer versions, unless usage proves high enough to justify it.

Availability

Stata is available to researchers and students from the University of Göttingen, University Medical Center Göttingen (UMG), and Max Planck Society (MPG). Stata is available on our high-performance compute cluster, the SCC. To access Stata on the SCC, you will need to be assigned to an HPC project first. Once you are in an HPC project, please submit a support ticket and request access to the HPC_stata group. You can confirm which groups your user belongs to using the command groups while logged into the cluster. The list is only updated on login, if you have just been added, make sure to fully log out and log back in to be able to see the change.

Using Stata

Stata can be started in a number of ways, depending on if you want to work directly on the terminal, or use a graphical environment. In both cases, you will first have to load the Stata module:

module load stata/17.0

Stata is provided as a container, and loading the module will automatically load the Apptainer module and put the container’s current location into the $STATA_CONTAINER environment variable. Stata is provided in different versions: stata, stata-se, and stata-mp, as well as the graphical version of these (xstata and so on). To learn more about the difference between these, consult Stata’s documentation.

Starting Stata
Warning

Do NOT run anything with Stata on the log-in nodes, beyond trivial test calculations. Read our documentation regarding interactive jobs!

To use Stata on your terminal interactively, first start an interactive job. Then, either load into the container and then into the appropriate Stata version with apptainer run:

module load stata
apptainer run --bind /mnt,/local,/user,/projects,/scratch,$HOME,$TMPDIR,$PROJECT $STATA_CONTAINER
stata

or load your chosen Stata version directly in one step with exec:

module load stata
apptainer exec --bind /mnt,/local,/user,/projects,/scratch,$HOME,$TMPDIR,$PROJECT $STATA_CONTAINER stata

If your Stata job is too resource intensive or long for interactive jobs, it can be used

Note

Since this is a 4-core version of stata, there is no point in requesting more than 4 cores from SLURM.

#!/bin/bash
#SBATCH -p jupyter
#SBATCH -N 1
#SBATCH -c 4
#SBATCH -t 60:00

module load stata
apptainer exec --bind /mnt,/local,/user,/projects,/scratch,$HOME,$TMPDIR,$PROJECT $STATA_CONTAINER stata-mp myscript.do

For more on writing SLURM scripts, consult our documentation.

Note

It is also possible to use Stata in graphic mode via ssh -X, but this is very slow and thus not recommended.

The best way to use Stata in graphic mode is with our HPC Desktops provided by JupyterHPC. Once loaded into the chosen Desktop environment, open a terminal. Then, load Stata as usual, but make sure to use one of the graphical versions starting with x (or you can also still use the text-based versions).

module load stata
apptainer exec $STATA_CONTAINER xstata

This will load the graphical version of Stata.

Common Tasks and Problems

Installing ado Packages

Extra libraries and packages, also known as ado packages, can be installed from within the container, either in terminal or GUI mode. For this, install the ado packages as usual with any other Stata setup. Afterwards, you will find the installed packages in your home directory, under ~/ado/. This means installed packages will survive across container restarts, but will not be transferred if you change users or projects. This is also the location to put any user-developed ado packages.

It is also possible to configure Stata so it looks for packages in other locations. For example, you can install packages to the HPC project’s $PROJECT location, and then have all users in the project use that location. This way, only one centralized package installation location is required for the whole group.

If you are using Stata from a compute node (within an interactive job), make sure you request internet access for your job, using -C inet, or you will not be able to install any packages from online repositories. This is not necessary when using JupyterHPC.

Start-up Configuration Files

To fix a problem with installing new ado packages on our JupyterHPC platform, the container has a pre-defined startup configuration script under /usr/local/stata/profile.do that sets up some required proxy commands. If this causes problems with your specific Stata configuration, you can create local configuration scripts that should take precedence over it. Please consult Stata’s own documentation on this matter if necessary.

Stata Can’t Find Other Files

Stata is being run from a container, which by default doesn’t set up all available storage spaces. You might need to add additional storage spaces to the --bind option when starting the Stata container. Please consult our Apptainer documentation for more information on binding storage locations.

Accessing Data and Files in the Windows Storage Area

Stata was previously available in our Windows domain. If you still have files in the personal storage of your user in the Windows domain, these can be accessed via the SAMBA protocol with smbclient or using rclone. More information on the SAMBA storages and how to use smbclient is provided in the non-HPC GWDG documentation. For more information on using rclone, see Data Transfers.