Learn R Programming

foreign (version 0.8-87)

read.xport: Read a SAS XPORT Format Library

Description

Reads a file as a SAS XPORT format library and returns a list of data.frames.

Usage

read.xport(file, ...)

Value

If there is a more than one dataset in the XPORT format library, a named list of data frames, otherwise a data frame. The columns of the data frames will be either numeric (corresponding to numeric in SAS) or factor (corresponding to character in SAS). All SAS numeric missing values (including special missing values represented by ._,

.A to .Z by SAS) are mapped to R

NA.

Trailing blanks are removed from character columns before conversion to a factor. Some sources claim that character missing values in SAS are represented by ' ' or '': these are not treated as R

missing values.

Arguments

file

character variable with the name of the file to read. The file must be in SAS XPORT format.

...

passed to as.data.frame when creating the data frames.

Author

Saikat DebRoy saikat@stat.wisc.edu

References

SAS Technical Support document TS-140: ``The Record Layout of a Data Set in SAS Transport (XPORT) Format'' available at https://support.sas.com/content/dam/SAS/support/en/technical-papers/record-layout-of-a-sas-version-5-or-6-data-set-in-sas-transport-xport-format.pdf

See Also

lookup.xport

Examples

Run this code
if (FALSE) ## no XPORT file is installed
read.xport("test.xpt")

Run the code above in your browser using DataLab