Open an SPSS (.sav) or Stata (.dta) data file without SPSS or Stata
Sent a survey dataset, downloaded one from a data archive, or left with files from a licence that ran out? Drop the .sav, .zsav or .dta here to see the cases as a table and every variable with its label, value labels and missing-value codes, then save the whole file as CSV, with the labels or with the raw codes.
The file is read on your device. It is never uploaded.
What it shows
- The cases as a table you can scroll sideways on a phone: the first 1,000 rows are drawn, and the page states how many the file holds. Tap a cell to see its stored code and its label together, and whether SPSS counts that code as missing.
- Every variable: its name (SPSS long names up to 64 characters, not the 8-character short names), its label (Satisfaction with life, 1–5), its type and width, its display format (
F8.2,DATE11,%td,%10.2f), the SPSS measure level (nominal, ordinal, scale), its value labels (1 = Male; 2 = Female) and its missing-value codes (9,-99 thru -1). - Codes or labels. One switch shows
1orMalein every labelled column; values without a label stay as they are. - The whole file as CSV, with labels or with codes, every row, not only the 1,000 on screen. UTF-8 with a byte-order mark, so Excel shows accents and non-Latin text correctly; text with commas, quotes or line breaks is quoted the standard (RFC 4180) way.
- Dates as dates. SPSS stores a date as seconds since 14 October 1582 and Stata as days (
%td) or milliseconds (%tc) since 1 January 1960. The page writes them as2018-05-06or2018-05-06 10:10:10in the table and the CSV, instead of13,744,944,000. Stata's monthly and quarterly dates come out as2018-05and2018q2. - The file's own facts: the program and version that wrote it (IBM SPSS Statistics 64-bit MS Windows 25.0.0.0, or the Stata format number), the date it was saved, the file label, the case count, the text encoding, the compression and the weight variable if one is set. SPSS document lines and Stata dataset notes are listed too.
What it cannot do
- SPSS portable files (.por). The older text-encoded export is recognised and named, not opened. SPSS, the free PSPP or R's
haven::read_por()read it; saved again as .sav it opens here. - Stata files older than format 114, that is from Stata 9 or earlier (formats 104 to 113). They are named and refused. Stata's
saveoldor R's haven writes a newer copy. - Password-encrypted .sav files (SPSS can save a data file encrypted with a password). They are not decrypted: open them in SPSS with the password and save an unencrypted copy.
- Statistics. No frequencies, means, crosstabs or regressions, and the weight variable is named but not applied: the table and the CSV have one line per case, unweighted. Open the CSV in a spreadsheet, R, Python or PSPP for the analysis.
- Searching and sorting. The table shows the rows in file order; the first 1,000 are on screen, all of them in the CSV.
- Other statistics formats: SAS (.sas7bdat, .xpt), R (.rds, .RData), SPSS output (.spv) and syntax (.sps) files are not read. CSV and Excel files have their own viewers.
- Extras SPSS keeps beside the data: multiple-response sets, custom variable attributes and roles are skipped. Number formats such as
DOLLARorCOMMAare shown as plain numbers, with the full stored precision. - Binary Stata strLs (a picture or a document stored in a cell) show as binary, N bytes and are not saved.
- Very large files. The whole file is read into the tab's memory. Files of a few hundred MB open on a desktop; a phone may give up well before that.
Useful to know about SPSS and Stata files
- How they are told apart. Every SPSS data file starts with the four characters
$FL2(or$FL3for a .zsav), then the name of the program that wrote it. A Stata 13 or later file starts with the text<stata_dta><header><release>117(or 118, 119); a Stata 10–12 file starts with the byte 114 or 115. viewhack reads those bytes, not the extension, so a renamed file still opens. - Not every .sav is SPSS. Python's scikit-learn tutorials save trained models with
pickleunder the namemodel.sav. Such a file starts with the byte80, not$FL2; dropped here or on the front page, it goes to the AI model inspector, which lists the code it would run on loading. - Compression. A "compressed" .sav (the SPSS default) stores small whole numbers from -99 to 151 in one byte instead of eight, and a run of spaces as one byte: survey files often shrink to a quarter. A .zsav (SPSS 21 and later) adds zlib on top and is usually smaller again. Stata files are not compressed.
- Missing values work differently. SPSS has one system-missing value (an empty cell) and lets each variable declare up to three codes, or a range and one code, as user-missing (for example
-9 = Don't know): the codes stay in the data and SPSS leaves them out of statistics. Stata has.plus 26 extended codes.ato.z, all larger than any number, which a value label can name (.a = Refused). - Text encoding. SPSS 16 and later can write UTF-8, and say so inside the file; older files use the PC's code page, which the file names by number (1252 for Western Europe). Stata 14 and later (format 118) write UTF-8; earlier Stata files are read as Windows-1252.
- Other ways to open one. The free, open-source PSPP (GNU) opens .sav and .por files on Windows, macOS and Linux. In R,
haven::read_sav()andhaven::read_dta(); in Python,pandas.read_spss()(with pyreadstat installed) andpandas.read_stata(). Stata 16 and later imports .sav withimport spss. This page needs no install and works on a phone.
How it works
The file is read in this tab by viewhack's own SPSS and Stata readers, written for this site from PSPP's description of the SPSS system file format and Stata's published description of the .dta format (no permissively licensed JavaScript reader existed). The SPSS reader walks the dictionary records (variables, value labels, documents, long names, very long strings, encoding), then undoes the bytecode compression case by case; for a .zsav it first unpacks the zlib blocks with fflate 0.8.3 (MIT), served from this site. The Stata reader follows the file's sections, from the header to the value-label tables. Nothing is sent anywhere, and nothing is kept once you close the tab.