1  Stata’s Interface

When you start up Stata, the first thing you’ll see is the main user interface window:

Stata’s Graphical User Interface

The big central section is the Results window, where you’ll see the results of the commands you run. Under it is the Command window, where you’ll type commands when you’re working interactively.

On the left is the History window, which contains a history of the commands you’ve run. Click once on a command to paste it back into the Command window for editing. Double-click on a command to run it again. You can also press Page Up when you’re in the Command window to recall past commands. Right-click on a command or block of commands to copy it into the clipboard or send it to the Do File editor. This allows you to take something you’ve done interactively and turn it into part of a do file.

Beneath the History window Stata displays the working directory. This is where Stata will save files if you don’t specify another location.

On the right is the Variables windows, which contains a list of the variables in the current data set. Click once on a variable name to select it, and information about the variable will be shown in the Properties window on the bottom right. Click twice, and the variable name will be pasted into the Command window. You can also start typing a variable name in the Command window and press Tab, and Stata will either complete the variable name or give you a list of variables that match what you’ve typed so far.

The Properties window also has a section for properties of the data set. One to keep an eye on is the size, or how much memory it requires. Stata must load your entire data set into memory. Modern computers have so much memory that most Stata users never have to worry about it, but big data users must make sure they don’t run out of memory. If you try to use more memory than your computer has, the operating system will use disk space as memory and Stata will become so slow that it’s practically unusable.

If a command is running, the button on the far right of the top toolbar will turn stop-sign red. Clicking it will tell Stata to stop what it’s doing—though it may take some time to notice. Pressing q will do the same thing.

The menus above the toolbar give you access to most of Stata’s commands and a graphical user interface for running them, but you’ll work much faster if you type them instead. There are some situations where the menus are useful. Importing data from non-Stata formats is one, because the graphical user interface will give you a preview of the data you can use to figure out the correct options for importing it. Making graphs is another, because there are so many options for graphs that setting them using the graphical user interface is a good alternative to memorizing them all. When you do something using the menus, Stata will craft a command based on what you chose and add it to the history just as if you’d typed it. You can then paste the command into a do file to make it reproducible.