def read_sas(filepath_or_buffer, format=None, index=None, encoding=None,<EOL>chunksize=None, iterator=False):
if format is None:<EOL><INDENT>buffer_error_msg = ("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL>filepath_or_buffer = _stringify_path(filepath_or_buffer)<EOL>if not isinstance(filepath_or_buffer, str):<EOL><INDENT>raise ValueError(buffer_error_msg)<EOL><DEDENT>fname = filepath_or_buffer.lower()<EOL>if fname.endswith("<STR_LIT>"):<EOL><INDENT>format = "<STR_LIT>"<EOL><DEDENT>elif fname.endswith("<STR_LIT>"):<EOL><INDENT>format = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>if format.lower() == '<STR_LIT>':<EOL><INDENT>from pandas.io.sas.sas_xport import XportReader<EOL>reader = XportReader(filepath_or_buffer, index=index,<EOL>encoding=encoding,<EOL>chunksize=chunksize)<EOL><DEDENT>elif format.lower() == '<STR_LIT>':<EOL><INDENT>from pandas.io.sas.sas7bdat import SAS7BDATReader<EOL>reader = SAS7BDATReader(filepath_or_buffer, index=index,<EOL>encoding=encoding,<EOL>chunksize=chunksize)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if iterator or chunksize:<EOL><INDENT>return reader<EOL><DEDENT>data = reader.read()<EOL>reader.close()<EOL>return data<EOL>
Read SAS files stored as either XPORT or SAS7BDAT format files.

Parameters
----------
filepath_or_buffer : string or file-like object
    Path to the SAS file.
format : string {'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 : string, 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.
iterator : bool, 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