pandas.read_sas

pandas.read_sas(filepath_or_buffer, format=None, index=None, encoding=None, chunksize=None, iterator=False)[source]

Read SAS files stored as either XPORT or SAS7BDAT format files.

Parameters
filepath_or_bufferstring or file-like object

Path to the SAS file.

formatstring {‘xport’, ‘sas7bdat’} or None

If None, file format is inferred from file extension. If ‘xport’ or ‘sas7bdat’, uses the corresponding format.

indexidentifier of index column, defaults to None

Identifier of column that should be used as index of the DataFrame.

encodingstring, default is None

Encoding for text data. If None, text data are stored as raw bytes.

chunksizeint

Read file chunksize lines at a time, returns iterator.

iteratorbool, defaults to False

If True, returns an iterator for reading the file incrementally.

Returns
DataFrame if iterator=False and chunksize=None, else SAS7BDATReader
or XportReader
Scroll To Top