Updated July 2018
Reading in Stata Format (.dta) Data Files
This set of notes describes how to make use of data files within the computer program Stata. It
assumes that you have already installed Stata on your computer, following the “Getting Started
with Stata” handout. It also assumes that you have started Stata up on your computer and are
looking at its main screen, on which there is a Stata Results window and a Stata Command box.
This handout uses the 2016 General Social Survey to illustrate Stata commands and output in all
handouts in this series. You can download the 2016 data file, GSS2016.DTA, two different
ways. You can download it from the GSS’ website: go to http://gss.norc.org/get-the-data/stata,
scroll to the “Download Individual Year Data Sets” text box and click “2016” to begin an
automatic download of the dataset. Alternatively, you can download it here:
https://canvas.harvard.edu/courses/53958.
Stata data files have .dta extensions. See the “How to Import an Excel or Text Data File into
Stata” handout for information on how to import other types of data files into Stata.
You can read a data file on your computer into Stata by typing
use <filename>
in the Stata Command box. You do not have to type the .dta extension, which is assumed. So to
read in the 2016 GSS data file (GSS2016.DTA), one would type:
use GSS2016
If the file is not in the default directory assumed by Stata, you have to add information about the
search path to be used to find the data.
On a PC:
For example, if GSS2016 was not in the default directory, one would have to type
use "S:\Data\Data sets\GSS2016.DTA"
to indicate that the data are to be found on drive S:, in the folder: Data\Data sets.
You would type whatever directory information is appropriate for your own computer, of
course.
On a Mac:
For example, if GSS2016 was not in the default directory, one would have to type
use "/Users/user1/Data/GSS2016.DTA"