DTA to CSV

A .dta file is Stata's dataset format. This turns it into a CSV anyone can open, with the variable list and the value labels written to two extra files.

Convert toCSV
Options
Options
Write the label stored for a code (1 becomes "Male") or keep the numeric code. The value labels list is included either way.
User-defined (SPSS) and extended missing values (Stata .a, SAS .A) can be left empty like system-missing values or kept as stored.
Readable dates such as 2024-03-01 (real dates in Excel), or the numbers the file stores, e.g. seconds since 1582 in SPSS.
Helps Excel read accents and other scripts correctly when the file is double-clicked. Turn it off for tools that trip over it.
Text that starts with =, +, -, @ or a tab gets a leading apostrophe, so Excel shows it as text instead of running it. Numbers are never changed.

Your file is converted on your computer. It is not uploaded anywhere.

How it works

  1. Drop your file in the box above, or click it to pick one.
  2. Pick the output format and press Convert.
  3. Download the result. Nothing was uploaded on the way.

Is it safe?

Replication data and register extracts often carry conditions on where they may be stored. This .dta is converted by code running in your own browser, and the data isn't copied to any server.

Want to check? Open your browser DevTools, switch to the Network tab and convert a file. Or convert a small file once, because each converter downloads its code the first time, then go offline and convert your real file.

Why people end up with a .dta

Economists, political scientists and epidemiologists use Stata a lot, and journals and data archives publish replication files as .dta. Then someone without Stata needs them: a co-author who works in R, a student, a policy team that only has Excel. Stata licences aren't cheap, and you shouldn't need one to read a table.

Labels, codes and extended missing values

Stata attaches value labels to numeric variables: 1 = "employed", 2 = "unemployed". With Coded values on "Value labels" the CSV says employed; on "Numeric codes" it says 1. Either way the full label list is written to yourfile-value-labels.csv, and yourfile-variables.csv lists each variable with its label, type and display format.

Stata's plain missing value (.) is always an empty field. The extended ones, .a to .z, mean different things in different datasets ("don't know", "not applicable"). They're left empty by default; "Keep the stored code" under Missing values writes them as .a, .b and so on, so the distinction survives. If .a has a value label of its own, say "refused", and Coded values is on labels, you see the label.

Dates come out readable

Inside the file a %td date is a day count from 1 January 1960, and a %tc date-time counts milliseconds from the same point. Nobody wants to read 23436. With "Readable dates" you get 2024-03-01, and Stata's period formats are written as 2024-03 (%tm), 2024-Q1 (%tq), 2024-H2 (%th) or 2024-W05 (%tw). "Stored numbers" keeps the raw counts, which is what you want if the CSV goes back into Stata.

Versions and limits

Both the older binary .dta versions and the newer format Stata 13 introduced (the one that starts with <stata_dta>) are read. Files up to 200 MB convert on a computer; phones and tablets stop earlier. The CSV itself has no row limit. Notes attached to the dataset with Stata's notes command aren't carried over.

Questions about this format

Can I open a .dta file in Excel?

Not directly; Excel doesn't know the format. Convert it to CSV here, or use DTA to Excel for a workbook with the data, variables and labels on separate sheets.

Which Stata versions does it read?

Files saved by old Stata releases as well as the current .dta format used since Stata 13, which Stata 14 and later extended for Unicode text.

What happens to .a, .b and other extended missing values?

They become empty fields by default, like the plain dot. Choose "Keep the stored code" under Missing values to keep them visible as .a, .b and so on.

Will the CSV read back into Stata cleanly?

Yes with import delimited. For a faithful round trip pick Numeric codes and Stored numbers, then reattach the labels from the value labels file if you need them.

Last updated: