**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: | 14 |

Installed Versions: | 13, 14 (KillDevil)
14, 15 (Longleaf) |

Research Computing servers: | Killdevil , Longleaf |

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

Version 12 is no longer available as of Jul 23, 2015.

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

Stata is available for use on the Research Computing servers 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 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: Longleaf 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. You can use the following command it as necessary to suit your job’s requirements:

bsub stata-se -b do statajob.do

The above command submits the Stata script “statajob.do” and creates an output file called “statajob.log” in the current working directory.

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

bsub -IS xstata

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

## Notes

- What’s New in Stata 14
- Versions 14 are now available. If you need Stata 14 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