pandas / 1.4.0 / reference / api / pandas.read_sas.html /

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_buffer :str, path object, or file-like object

String, path object (implementing os.PathLike[str]), or file-like object implementing a binary read() function. The string could be a URL. Valid URL schemes include http, ftp, s3, and file. For file URLs, a host is expected. A local file could be: file://localhost/path/to/table.sas.

format :str {‘xport’, ‘sas7bdat’} or None

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

index :identifier of index column, defaults to None

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

encoding :str, default is None

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

chunksize :int

Read file chunksize lines at a time, returns iterator.

Changed in version 1.2: TextFileReader is a context manager.

iterator :bool, defaults to False

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

Changed in version 1.2: TextFileReader is a context manager.

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

© 2008–2022, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.4.0/reference/api/pandas.read_sas.html