The Basics of STATA

Last updated on March 8, 2022

There are three main types of files used in Stata:
Data File: Filename.dta  
Syntax File:  
Output file: Filename.log

The data file is where all the data live. The syntax is where you tell STATA what to do with your data. The output is where you see the results of what you told Stata to do.

You can also tell Stata what to do and see results in the main screen in Stata, but you can only give one command at a time and they don’t get saved in the big screen for you to go back to. That’s why it’s a good idea to stick with a .do file where you can have a complete set of commands to tell Stata what to do (perhaps this is why it’s called a .do file ¯\_(ツ)_/¯).

A completed .do file might look something like this:

and the output for it might look something like this:

Here are some barely legible tips on how to set up a syntax (.do) file in Stata.

Comments are closed.