Skip to Main Content

Economics: Stata

Library resources available to support the Department of Economics program

Overview

Stata is a statistics software designed to help manipulate, analyze, and display data. Most upper-level economics classes
that involve statistics use Stata, as well as many professionals. This guide is here to help you at any skill level.

Learning Stata

Knowing the basic syntax of Stata will help immensely in the long run. Find the tutorial style (video, instruction set, website) that works best for your learning strategy.  Try a Google search of anything that doesn’t make sense. 

Beginner


Intermediate


Advanced

Accessing Stata & Stata Files

  • All BYU Computers have Stata downloaded automatically. These can be found in the library or WVB and are free to use.  Note that files saved on the hard drive will be deleted when the user logs out. 
  • To use BYU’s Stata subscription on your own computer or from home, go to cloudapps.byu.edu, log in, and search for Stata. Note that running this version of Stata can be slow and cumbersome.
  • Save files you want to access in Stata in Box, BYU's cloud storage platform.  This allows you to use them on campus or from home.

Troubleshooting

Methods for troubleshooting code and syntax errors.

  • You can use the "help" command by typing help and then typing the command you are using. For example, to access help about the “generate” command, the words help generate would be typed.

  • When reading Stata’s help documentation, the syntax is as follows: regular text is required within the command, italics represent code that the user must input, (parenthesis) represent separate parts of the code, [brackets] are optional additions to the code.

  • If you’re not sure why the code isn’t working, read through it carefully and watch for small mistakes like misspellings, incorrect formatting, or extra spaces.

  • Syntax errors: String variables must be expressed within “quotation marks,” when conditional (if) statements are used, == means equal to while != means not equal to, all misspellings will create the wrong result. 

  • Excel files: it is usually more useful to export an excel file as a CSV file (Comma delimited), but CSV files cannot be referenced in Stata with the "use" function, they must be referenced with the "import delimited" function. 

  • Can’t open files: changing Stata’s working directory in the do file or through the menus at the top of the command window is a good way to troubleshoot difficulties opening files.  The "cd" command is used to change the directory.

  • Still having issues: schedule an appointment with Maggie (below) or a meeting with the Econ TAs.