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