XPORT (.stx, .xpt)

Background & Context

    • MIME type: application/x-sas-xport
    • SAS XPORT transport format.
    • Legacy data exchange format.
    • Stores numerical datasets in a portable format.
    • Text format.
    • Developed in the late 1980s by SAS Institute.

Import

  • Import["file.xpt"] imports an XPORT file, returning all datasets arranged as a table.
  • Import["file.xpt"] returns a table, representing each dataset as a column.
  • XPORT data is represented in the Wolfram Language by real or integer numbers, strings, Boolean values True and False, and DateList specifications.
  • Import["file.xpt",elem] imports the specified element from an XPORT file.
  • Import["file.xpt",{elem,suba,subb,}] imports a subelement.
  • Import["file.xpt",{{elem1,elem2,}}] imports multiple elements.
  • The import format can be specified with Import["file","XPORT"] or Import["file",{"XPORT",elem,}].
  • See the reference pages for full general information on Import.
  • ImportString supports the XPORT format.

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties and settings
    "Summary"summary of file size and dimensions
  • Data representation elements:
  • "Data"two-dimensional array
    "Dataset"table data as a Dataset
    "LabeledData"association of labels and data
  • Import by default uses the "Data" element.
  • Data descriptor elements:
  • "LabelDescriptions"description and types of columns
    "Labels"names of columns
    "MissingPositions"positions of elements considered to be missing per column
    "MissingValues"values to be considered missing per column
  • Metadata elements:
  • "ByteOrdering"endianness of the data
    "CharacterEncoding"character encoding of the file
    "Comments"comments on the file
    "Compression"type of compression used in the file
    "CreationDate"creation date of the document, given as a DateObject
    "Dimensions"dimensions of the data
    "MetaInformation"metadata given as strings and date objects
    "ModificationDate"modification date of the document, given as a DateObject
    "TableName"name of the entire table
    "Version"version of the SAS specification for the file

Options

  • Import options:
  • "ColumnDefaultValues"Automaticassociation of column names and default values
    "TypeDefaultValues"Automaticassociation of types and default values

Examples

open allclose all

Basic Examples  (2)

Import an XPORT file:

Summary of an XPORT file:

Import Elements  (13)

Data Representation  (3)

"Data"  (1)

Import an XPORT file as a 2D list of values:

This is also the default element:

"Dataset"  (1)

Import an XPORT file as a Dataset:

"LabeledData"  (1)

Import an XPORT file as an association of labels and data:

Data Descriptors  (3)

"LabelDescriptions"  (1)

Import associations giving the name, description and type for each column in an XPORT file:

"Labels"  (1)

Import the names of each column in an XPORT file:

"MissingPositions"  (1)

Import associations giving the positions of missing values by column:

Metadata  (7)

"Comments"  (1)

Import comments stored in the metadata of an XPORT file:

"CreationDate"  (1)

Import the creation date:

"Dimensions"  (1)

Import the data dimensions:

"MetaInformation"  (1)

Import an association of all the metadata stored in an XPORT file:

"ModificationDate"  (1)

Import the modification date:

"TableName"  (1)

Import the table name stored in the metadata of an XPORT file:

"Version"  (1)

Import the version of an XPORT file:

Import Options  (2)

"ColumnDefaultValues"  (1)

Missing numerical values are replaced with zero by default:

Use "ColumnDefaultValues" to specify a different default value for specific columns:

"TypeDefaultValues"  (1)

Missing numerical values are replaced with zero by default:

Use "TypeDefaultValues" to specify a different default value for specific types: