Data @ Reed

Data files and file types in Stata

Stata, like many proprietary statistical software packages, has its own data format -- *.dta files are Stata data files. Stata can read other file types, including comma-separated values (*.csv) files and Microsoft Excel files (*.xls/*.xlsx). Note: If you have a file in another format (e.g. from SAS, SPSS, etc), you can use StatTransfer to convert the file type. Find StatTransfer (and KeyClient, which you will need to run StatTransfer), on the Reed Downloads page.

Loading data

There are a number of ways to load data into Stata.

Using the menus

If you are working with a *.dta file: File > Open

If you are working with a *.xls, *.csv,  *.txt (etc) file: File > Import and select the appropriate file type. Note: When importing data, be sure to specify your delimiter and check the 'Use first row for variable names" box if appropriate.

At the command line

If working with at *.dta file: use [filename]. (Example: use thesis_data) It is not necessary to specify the *.dta extension. Make sure you navigate to the directory where your datafile resides, if you are not already there.

Example: cd "/Users/bottk/Documents/2014-2015/thesis_2014-2015")

If you are working with another file type, the command to use is import. Check the documentation for which arguments the command accepts.

Example, importing a comma-delimited (*.csv) file where variable names are the first row in my datafile: 

import delimited "/Users/bottk/Desktop/thesis_data/RiceWheat.csv", delimiter(comma) varnames(1) 

Below the command line

You can also use these icons to browse for and select your file. Note: this only works for Stata data (*.dta) files.