SAS7BDAT to CSV

.sas7bdat is the file a SAS library keeps each dataset in. Drop one here and you get the rows as CSV, or an Excel workbook if you prefer, without a SAS installation.

Options
Options
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?

SAS datasets tend to come out of banks and hospitals, which is to say they're the last thing you'd want sitting on a stranger's server. This one is decoded inside your browser and stays on your machine.

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.

No value labels in SAS files, and why

This is the main difference from SPSS and Stata. In SAS, the text behind a code ("1 = Male") is a user-defined format, and formats are stored in a separate catalog file (.sas7bcat), not in the dataset. The converter reads the .sas7bdat only, so coded variables stay as numbers, and there's no labels-or-codes switch on this page. If you have the program that built the formats (a PROC FORMAT block), it tells you what each code means.

Variable labels are a different thing and do live in the dataset, so they come along.

The files you get

With CSV output: name.csv with the data, name-variables.csv with each variable's name, label, type and SAS format (DATE9., BEST12. and so on), and a value labels file that stays empty apart from its header, for the reason above. With Excel output the same tables become sheets of one workbook, capped at about 3 million data cells.

Dates, times and missing values

SAS counts dates in days and date-times in seconds, both from 1 January 1960. Variables with a date or time format (DATE9., MMDDYY10., DATETIME20., TIME8. and many others) are written as 2024-03-01, 2024-03-01 13:45:00 or 13:45:00 with Dates and times on "Readable dates". A date stored without a date format looks like any other number to the converter and stays a number.

The ordinary missing value (.) is an empty field. Special missing values .A to .Z are empty too, unless Missing values is set to "Keep the stored code".

Where these files show up

Clinical trials, credit risk, insurance pricing and government statistics all run on SAS, and datasets get handed out as .sas7bdat: to a consultant, to a university team, to a regulator. The people receiving them often use R, Python or just Excel. The format was never publicly documented, so every reader outside SAS relies on reverse-engineered code. This one uses the open-source ReadStat library. Files up to 200 MB convert on a computer, less on phones.

Questions about this format

How can I open a .sas7bdat file without SAS?

Convert it here to CSV or Excel. In code, pandas.read_sas in Python and the haven package in R also read it.

Why are my coded variables still numbers?

Because the code labels are SAS formats kept in a separate catalog file, which this converter does not read. The dataset itself only holds the numbers.

Does it convert SAS7BDAT to Excel too?

Yes, pick Excel XLSX as the output. For very large datasets stay with CSV, which has no row or cell limit.

What about .sas7bcat catalog files?

They aren't supported. A catalog holds formats, not data, so there is nothing table-shaped in it to convert.

Last updated: