**Table of Contents**

Setting up environment and invoking from a Research Computing server

Submitting Stata jobs on a Research Computing server

## Overview

Stata is a complete, integrated statistical package for data analysis, data management, and graphics. It covers a wide range of statistical techniques and is programmable. Stata includes a variety of routines to analyze complex data and is a general purpose statistical package with good graphics capabilities and a graphic editor. Among the highlights of Stata are that it is relatively easy to learn for beginners. A fast and complete matrix programming language is an integral part of Stata.

You can choose to either install Stata locally in your personal computer or invoke it from a Research Computing Server.

Default Version: | 13 |

Installed Versions: | 12, 13 |

Research Computing servers: | Kure, Killdevil |

## Installation

You can purchase and install Stata locally in your computer. Stata is available to faculty and students through UNC Software Acquisition. Please visit their webpage for more information.

## Special Note

Versions 9 and 10 are no longer available as of October 25, 2011, version 11 no longer available as of July 23, 2013.

## Setting up environment and invoking from a Research Computing server

Stata is available for use on the Research Computing servers Kure and Killdevil. The following documents provide several options for running Stata and other high-performance computing software. These documents include general instructions common to all applications, and specific instructions for each application.

- Invoking applications on a Research Computing server from a UNIX/Linux desktop computer
- Invoking applications on a Research Computing server from a Microsoft Windows computer

## Submitting Stata jobs on a Research Computing server

This section covers specific examples of how to submit various types of Stata jobs on Research Computing’s two main compute clusters: Kure and KillDevil.

To start you will need to add Stata to your cluster environment using the module commands:

module add stata

module initadd stata

All of the following examples assume you are in the directory where your Stata script is located.

### Serial job submission

The first examples cover submitting serial Stata jobs. On Kure, the easiest way to submit a serial Stata job is to use the **bstata** script:

bstata statajob.do

In the above example, “statajob.do” is the name of the Stata script being submitted and the job submission will create an output file called “statajob.log” in the current working directory.

If you do not want to use the bstata script then you can use the following command instead and modify it as necessary to suit your job’s requirements:

bsub stata-se -b do statajob.do

The above command (which should all be on one line) submits the Stata script “statajob.do” and creates an output file called “statajob.log” in the current working directory. **Note that the bstata script is not available on the KillDevil cluster.**

### Parallel job submission

The next example covers how to submit Stata parallel jobs using Stata/MP. To begin with, in your Stata script you should have the following Stata code

**where “m” has to be an integer between 1 and 8 and indicates the number of processors you want to use for the job**. Then to submit your job you can do the command:

bsub -n m -R "span[hosts=1]" stata-mp -b do stataparjob.do

**In the above bsub command “m” needs to be the same number as you specified in your “set proce_use” statement**. This command (which should all be on one line) submits a Stata script called “stataparjob.do” and creates an output file called “stataparjob.log” in the current working directory.

### Interactive job submission

Finally, to start a Stata job on the compute cluster which gives you the Stata GUI you can do the command

For Kure:

xstata

For Killdevil:

bsub -IS xstata

For these commands to work you need to have an X connection to the server.

## Notes

- What’s New in Stata 12
- What’s New in Stata 11
- Versions 11, and 12 are now available. If you need Stata 11 to behave like an older version of Stata, type version at the . prompt or in the command window as appropriate.

## Short courses

- An Introduction to Stata course is offered by Research Computing group on a
**periodic****basis**. For more information about the current schedule of ITS courses and to register to one please visit Live Training Class Registration. - Stata short courses at the Odum Institute.

## Tutorials

## FAQs

Please read Stata Common FAQs regarding the following types of questions useful for users new to this software.

## Useful links

- Stata Home Page
- Stata Technical Support
- Stata resources, a list compiled by StataCorp that includes links to a number of tutorials
- The Carolina Population Center’s Stata Tutorial . This tutorial is designed to help a new Stata user learn Stata.
- UNC’s A SAS User’s Guide to Stata . This guide is designed to help those who know SAS learn how to do the same tasks in Stata.
- UCLA’s Stata resources and UCLA’s Stata portal
- Statistical software components, an archive maintained by Boston College, which includes many Stata ado-files.

## Additional help