What is a .dta file?
Stata Dataset · Data · StataCorp · 1985
A .dta file is a Stata dataset: the native data format of the Stata statistics package, widely used in economics, epidemiology and social science. It stores the table plus labels, value codes and metadata.
What is a .dta file used for?
Stata's format is versioned, and files written by a newer Stata do not open in older releases, a constant headache in research teams; Stata's saveold command bridges the gap. Modern versions of the format begin with an XML-like <stata_dta> marker, while older releases used a bare binary header, so there is no single magic number across versions.
The rich metadata (variable labels, value labels, missing-value codes) is why researchers exchange .dta instead of CSV: the meaning of coded answers travels with the data.
What opens a .dta file?
The .dta format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list.
Windows
- Stata
- R (haven)
- Python (pandas.read_stata)
macOS
- Stata
- R (haven)
- Python (pandas)
Linux
- Stata
- R (haven)
- Python (pandas)
Open a .dta file step by step
- Confirm the file really is a .dta. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
- On Windows, open it with Stata or R (haven).
- On Mac, use Stata or R (haven).
- On Linux, try Stata or R (haven).
- Still stuck? Convert the .dta to csv, which opens more widely.
Why can't I open my .dta file?
Almost always because no installed app understands Stata. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.
The other possibility is that the file is not really a .dta at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.
How to convert a .dta file
You can convert a .dta file to csv, xlsx, sav, parquet using a conversion tool or the export menu of an app that opens it.
Stata has no fixed magic number, so there is no signature table on this page. Its bytes alone do not prove the format: identification relies on the extension, the structure of the content and the program that created it. The magic-numbers reference lists the formats that do carry one.
Frequently asked questions
What is a .dta file?
A .dta file is a Stata dataset: the native data format of the Stata statistics package, widely used in economics, epidemiology and social science. It stores the table plus labels, value codes and metadata.
How do I open a .dta file without Stata?
pandas.read_stata() in Python or the haven package in R read .dta files directly, including labels. Both are free.
Why won't my .dta file open in my Stata version?
It was saved by a newer Stata. Ask the sender to use saveold to write an older format version, or read it with R/pandas, which handle most versions.
How do I convert .dta to CSV or Excel?
Load it with pandas or haven and write CSV/XLSX. Note that value labels (coded categories) may need exporting separately if you want the text answers.
Related formats
Sources
Details on this page were checked against authoritative references. How sources are ranked and what is deliberately left out is set out in the methodology.