Main Content

xptread

Create table from data stored in SAS XPORT format file

Syntax

data = xptread
data = xptread(filename)
[data,missing] = xptread(filename)
xptread(...,'ReadObsNames',true)

Description

data = xptread displays a dialog box for selecting a file, then reads data from the file into a table. The file must be in the SAS XPORT format.

data = xptread(filename) retrieves data from a SAS XPORT format file filename. For example, to open a SAS XPORT file named sample.xpt, type data = xptread('sample.xpt') at the command prompt.

[data,missing] = xptread(filename) returns a nominal array, missing, that contains the missing data type information from the XPORT format file.

The XPORT format allows for 28 missing data types, represented in the file by an upper case letter or the characters '.' or '_'. If the XPORT file contains missing values, xptread converts them to NaN values in the output table, data. However, if you need the specific missing types, you can recover this information by specifying a second output, missing. The entries in missing are one of the 28 missing data type values from the XPORT format file ('.', '_', 'A',...,'Z'), or are undefined for values that are not present at all in the XPORT format file. The outputs missing and data are the same size.

xptread(...,'ReadObsNames',true) treats the first variable in the file as observation names. The default value is false.

xptread only supports single data sets per file. xptread does not support compressed files.

Version History

Introduced in R2009b

See Also