XPORT (.stx, .xpt)

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 fully supports the XPORT format.

Import and ExportImport and Export

  • Import["file.stx"] imports an XPORT file, returning all datasets arranged as a table.
  • Import["file.stx"] returns a table, representing each dataset as a column.
  • XPORT data is represented in Mathematica by real or integer numbers, strings, Boolean values True and False, and DateList specifications.
  • Import["file.stx", elem] imports the specified element from an XPORT file.
  • Import["file.stx", {elem, suba, subb, ...}] imports a subelement.
  • Import["file.stx", {{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.


  • 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
  • Data representation elements:
  • "Data"datasets arranged as a table
    "LabeledData"datasets given as a list of rules
  • Import uses the element by default.
  • Import["file.stx"] reads all datasets and returns them as a table.
  • Import["file.stx", "LabeledData"] imports the entire file and returns an expression of the form , where the are the table headings.
  • Meta-information elements:
  • "Labels"dataset names given as a list of strings
    "Metadata"information about each dataset, given as a list of strings


  • Import option:
  • "EmptyField"""how empty cells are represented in Mathematica

ExamplesExamplesopen allclose all

Basic Examples (1)Basic Examples (1)

Import an XPT file from a website and return the labels of all datasets:

Click for copyable input
Click for copyable input

Get the first few entries for the dataset:

Click for copyable input

Import two datasets and visualize them as a ListPlot:

Click for copyable input
Click for copyable input
New in 6
New to Mathematica? Find your learning path »
Have a question? Ask support »