Getting Started with Stata
What is Stata?
If you want to work in econometrics, chances are you’ll need to learn to use a statistical analysis package like Stata. Stata is one of the most widely used software packages to help students and researchers explore, summarise and analyse complicated datasets. The software is available in several different versions which differ mainly in the number of variables allowed in memory.
One of the major advantages of Stata is that it is eminently portable. Its developers are committed to cross-platform compatibility and so Stata runs the same way on Windows, macOS, Unix, and Linux systems. All versions of Stata provide the full set of features and commands: there are no special add-ons or toolboxes.
Five important features for getting started with Stata
1. The toolbar
The Toolbar contains icons that allow you to open and save files, print results, control Logs, and manipulate windows. Some very important tools allow you to open the Do-File Editor, the Data Editor and the Data Browser.
2. Current working directory
The cwd is the directory to which any files created in your Stata session will be saved. Likewise, if you try to open a file and give its name alone, it is assumed to reside in the cwd. If it is in another location, you must change the cwd [File >Change Working Directory] or qualify its name with the directory in which it resides. You generally will not want to locate or save files in the default cwd. A common strategy is to set up a directory for each project or task in a convenient location in the filesystem and change the cwd to that directory when working on that task. This can be automated in a do-file with the cd command.
3. Command panel
As you’d expect, to execute a command in Stata, you type it into the Command Panel. Although traditionally a command-line driven package, recent versions of Stata contain a user-friendly graphical user interface (GUI). A major advantage of the GUI is that when you are using a new command, you can easily find out the correct syntax to use by viewing it in the command panel.
4. Do file
The Do-File editor allows you to construct a file of Stata commands, or “do-file”, and execute it in whole or in part from the editor. A major advantage of a do file is that ability to quickly and effortlessly reproduce your analysis and results.
5. Adopath commands
Another advantage of Stata’s command-line driven environment involves extensibility: the continual expansion of Stata’s capabilities. Only a small fraction of the commands you can use in Stata are built in. If a command is not built into the Stata kernel, Stata searches for it, meaning you can acquire additional user contributed Stata commands from a number of online sources. Stata’s capabilities thus extend far beyond the official, supported features described in the Stata manual to a vast array of additional tools.
These tips are just a start, to gain a deeper understanding of the features of Stata we recommend attending an introductory course. For example, Timberlake’s Stata Fundamentals Online Course gives a complete introduction to Stata and is ideal for new users who want to get a head start and learn how to use the software efficiently. What’s more, with an online course you can learn from the comfort of your own home.
For more advice for economists, see these articles: