# Stata

Stata is a proprietary software package used for statistical analysis (there are free open-source options like R). Most undergrads can get away with the Small Stata version, but I'd suggest at least getting Stata/IC if you are a grad student. The web contains extensive amounts of information so this page will only be used as a holding spot for common or helpful exercises.

I will type Stata commands in Courier New font style and italicize any generic *command*. If you don't like the manuals, type "Stata help *command*" into a search engine or from the Stata prompt type help *command*, search *command*, or findit *command*. That last command installs add-on programs. If you're new, practice what's in the video and this site to familiarize yourself further.

To begin, I will try to place commands in a bold so they stand out. You'll notice that Stata commands are written in the following convention:

**. help describe**

**. search codebook**

**. findit renvars**

**. ssc renvars**

**. sysuse auto, clear**

**. renvars _all, prefix(cars_)**

Eliminate the periods before running the script but don't worry about them --- they are what Stata outputs when you run a command and placing them in front of a command line is the common way to write a Stata tutorial. In addition to reviewing The Stata Journal archives, you might want to take a gander at the pages listed above.

If you are comfortable with programming in Matlab, check out Stata's powerful Matrix programming language, Mata. If you like programming in C, you should look into Stata plugins. Regardless of what you use, you're not limited to Stata once you begin to learn its programming style and functions. To get started on your programming, there is a Princeton tutorial page, a document called “A little Stata Programming goes a long way,” and even some PDFs from the Stata 10 manual.

Finally, once you begin interacting with people from other schools or disciplines, you are going to run into the problem of people using other statistical packages. If you create a data set in Stata, you can easily hop back and forth between it and other programs (like Excel, Matlab, R, SPSS, SAS, etc) with a program called StatTransfer or use its built-in Stata command **stcmd**. If you need to zip up, try **unzipfile**, which somehow never managed to make its way into any manuals or help files! As a last tip, you might want to check out this sheet on regular expressions that a peer passed along to me (see Stata commands **regexp**, **regexr**, and **regexs**).