Skip to content

Stata

Many versions of Stata are installed on the ICER HPC. When you log in, Stata is not available by default, but it may be load easily using this command  (note you must type Stata with a capital 'S'

1
[hpc@dev-intel18 ~]$ module load Stata

This loads Stata SE version 15.  This is equivalent to using the command

1
[hpc@dev-intel18 ~]$ module load Stata/15.0.SE

Stata has a command line version and a GUI (windowed) version. To use the command line, type stata at the prompt. You will see this :

Using Stata command line

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
[hpc@dev-intel18 ~]$ module load Stata
[hpc@dev-intel18 ~]$ stata

  ___  ____  ____  ____  ____ (R)
 /__    /   ____/   /   ____/
___/   /   /___/   /   /___/   15.0   Copyright 1985-2017 StataCorp LLC
  Statistics/Data Analysis            StataCorp
                                      4905 Lakeway Drive
                                      College Station, Texas 77845 USA
                                      800-STATA-PC        http://www.stata.com
                                      979-696-4600        stata@stata.com
                                      979-696-4601 (fax)

15-user Stata network perpetual license:
       Serial number:  401506213245
         Licensed to:  iCER / HPCC at Michigan State University
                       East Lansing, MI

Notes:
      1.  Unicode is supported; see help unicode_advice.

.

In which you may type Stata commands. Type 'exit' to quit this version. 

To run a Stata do file from the command line in 'batch', you use the syntax

1
[hpc@dev-intel18 ~]$ stata -b do dofilename.do

Versions

Stata comes in several versions: IC, SE, and MP; see https://www.stata.com/products/which-stata-is-right-for-me/ for details for the differences. Stata/IC has limitations on the numbers of variables that affect most users but has no licensing restrictions (see below). While the default version of Stata available when you load the module is Stata/SE, you currently have to use the command 'stata-se' to start the 'SE' version

1
2
3
[hpc@dev-intel18 ~]$ module load Stata/15.0.SE
[hpc@dev-intel18 ~]$ stata-se  # to run the interactive version
[hpc@dev-intel18 ~]$ stata-se -b do dofilename.do  # to run a do file 

However, to use the "MP" Version, you must load it explicitly. 

1
2
[hpc@dev-intel18 ~]$ module load Stata/15.0.MP
[hpc@dev-intel18 ~]$ stata-mp

Note that even if you load Stata/MP or SE module, as above, if you just use the command stata it will load the IC version. To see which version of Stata you are current in, use the about command at the dot prompt. To use these special versions to run a bach do file, use stata-se and stata-mp instead of plain stata

For Stata/SE There are 15 licenses available, so 15 users may use it, for MP there are 5 user licenses of 8-cores each. Please exit the program when you are finished with it.  

GUI version

To use the GUI version, you must first be connected to HPCC with X11 forwarding ( MobaXterm for Windows, XQuartz for Mac - see  instructions on installing an SSH client )  or using a web-base connection to HPCC (see  instructions on Connecting via web site ). Once an X11 or remote desktop client is connected, you can run xstata on a dev node:

1
2
[hpc@dev-intel18 ~]$ module load Stata
[hpc@dev-intel18 ~]$ xstata

A screenshot of the Stata graphic user interface.

Variables Limits

Even if you load the MP or SE versions, Stata limits the number of variables to 5000 unless you tell it otherwise.    For information use the help set_maxvar command at the dot prompt.   You can set the maxvar for your session or in your do file with (for example to 6000)

1
. set maxvar 6000

There are other settings related to memory usage which are important as Stata attempts to be very conservative.  For more information use the Stata "memory" command

Running Jobs

Note you must use the command line version inside a sb script when running jobs.  To copy a working example of Stata job file into your  home directory, you can use our getexample tool

Getting Stata Example

1
2
3
4
5
6
7
module load powertools
cd ~
getexample STATA_example
cd STATA_example

# look into the README file in this folder for details
cat README

More help

For questions requiring deeper knowledge of statistics,  users could contact CSTAT services at  https://cstat.msu.edu/cstat-services and use the "schedule a meeting" link to submit an intake form.