From 49ec31bbaeca81a6f58fc1be26fe80f3ac188cdd Mon Sep 17 00:00:00 2001 From: Adam Smith Date: Mon, 22 May 2017 10:49:49 -0700 Subject: [PATCH] SAS DOC update - add documentation for sas_read(format='sas7bdat') (#16420) * updating comparison_with_sas.rst to include documentation for reading sas7bdat format * DOC: update docs for read_sas(format='sas7bdat') #12700 Issue #12700: DOC: update comparison_with_sas docs to include new read_sas(format='sas7bdat') --- doc/source/comparison_with_sas.rst | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/source/comparison_with_sas.rst b/doc/source/comparison_with_sas.rst index 7ec91d251f15d..875358521173a 100644 --- a/doc/source/comparison_with_sas.rst +++ b/doc/source/comparison_with_sas.rst @@ -577,9 +577,8 @@ Data Interop ~~~~~~~~~~~~ pandas provides a :func:`read_sas` method that can read SAS data saved in -the XPORT format. The ability to read SAS's binary format is planned for a -future release. - +the XPORT or SAS7BDAT binary format. + .. code-block:: none libname xportout xport 'transport-file.xpt'; @@ -591,6 +590,15 @@ future release. .. code-block:: python df = pd.read_sas('transport-file.xpt') + df = pd.read_sas('binary-file.sas7bdat') + +You can also specify the file format directly. By default, pandas will try +to infer the file format based on its extension. + +.. code-block:: python + + df = pd.read_sas('transport-file.xpt', format='xport') + df = pd.read_sas('binary-file.sas7bdat', format='sas7bdat') XPORT is a relatively limited format and the parsing of it is not as optimized as some of the other pandas readers. An alternative way @@ -605,3 +613,4 @@ to interop data between SAS and pandas is to serialize to csv. In [9]: %time df = pd.read_csv('big.csv') Wall time: 4.86 s +