Skip to content

Commit 49ec31b

Browse files
economyTomAugspurger
authored andcommitted
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')
1 parent 1f2085e commit 49ec31b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

doc/source/comparison_with_sas.rst

+12-3
Original file line numberDiff line numberDiff line change
@@ -577,9 +577,8 @@ Data Interop
577577
~~~~~~~~~~~~
578578

579579
pandas provides a :func:`read_sas` method that can read SAS data saved in
580-
the XPORT format. The ability to read SAS's binary format is planned for a
581-
future release.
582-
580+
the XPORT or SAS7BDAT binary format.
581+
583582
.. code-block:: none
584583
585584
libname xportout xport 'transport-file.xpt';
@@ -591,6 +590,15 @@ future release.
591590
.. code-block:: python
592591
593592
df = pd.read_sas('transport-file.xpt')
593+
df = pd.read_sas('binary-file.sas7bdat')
594+
595+
You can also specify the file format directly. By default, pandas will try
596+
to infer the file format based on its extension.
597+
598+
.. code-block:: python
599+
600+
df = pd.read_sas('transport-file.xpt', format='xport')
601+
df = pd.read_sas('binary-file.sas7bdat', format='sas7bdat')
594602
595603
XPORT is a relatively limited format and the parsing of it is not as
596604
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.
605613
606614
In [9]: %time df = pd.read_csv('big.csv')
607615
Wall time: 4.86 s
616+

0 commit comments

Comments
 (0)