WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

Background & Context

    • MIME type: application/x-spss-por
    • SPSS database transport format.
    • Legacy data exchange format.
    • Stores numerical datasets in a portable format.
    • Binary format.
    • SPSS was initially released in 1968 by Norman H. Nie, Dale H. Bent and C. Hadlai Hull.
    • Maintained by SPSS Inc. since 1975, and by IBM SPSS Statistics since 2009.

Import & Export

  • Import ["file.por"] imports a POR file, returning all datasets arranged as a table.
  • POR data is represented in the Wolfram Language by real or integer numbers, strings, Boolean values True and False , and DateObject specifications.
  • Import ["file.por",elem] imports the specified element from a POR file.
  • Import ["file.por",{elem,suba,subb,}] imports a subelement.
  • The import format can be specified with Import ["file","POR"] or Import ["file",{"POR",elem,}].
  • Export ["file.por",expr] creates a POR file from expr.
  • Supported expressions expr include:
  • {v1,v2,} a single column of data
    {{v11,v12,},{v21,v22,},} lists of rows of data
    array an array such as SparseArray , QuantityArray , etc.
    tseries a TimeSeries , EventSeries or TemporalData object
    Dataset [] a dataset
    Tabular [] a tabular object
    <|"name1"expr1,|> an association of named columns
  • Import and Export support the following data types:
  • "Date" date and time specifications
    "Integer8" 8-bit integers
    "Integer16" 16-bit integers
    "Integer32" 32-bit integers
    "Real32" IEEE singleprecision numbers
    "Real64" IEEE doubleprecision numbers
    "String" string of characters
  • See the following reference pages for full general information:
  • Import , Export import from or export to a file
    CloudImport , CloudExport import from or export to a cloud object
    ImportString , ExportString import from or export to a string
    ImportByteArray , ExportByteArray import from or export to a byte array

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Summary" summary of the file
    "Rules" list of rules for all available elements
  • Data representation elements:
  • "Data" two-dimensional array
    "Dataset" table data as a Dataset
    "EventSeries" table data as an EventSeries
    "LabeledData" association of labels and data
    "LabeledRawData" association of labels and raw data
    "Tabular" table data as a Tabular object
    "TimeSeries" table data as a TimeSeries
  • Import by default uses the "Data" element.
  • Data descriptor elements:
  • "ColumnDescriptions" description and types of columns
    "ColumnLabels" names of columns
    "ColumnTypes" association of column names and types
    "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" Automatic association of column names and default values
    "TimeColumn" Automatic column to use for times in "EventSeries" and "TimeSeries" elements
    "TypeDefaultValues" Automatic association of types and default values
  • Export options:
  • "ColumnDescriptions" Automatic list of descriptions for each column
    "MetaInformation" Automatic association of metadata tags and values
  • Possible settings for "ColumnDescriptions" include:
  • {"label1","label2", } list of strings giving column names
    {assoc,} list of associations giving column metadata
    <|colassoc|> association of index or column name and column metadata
  • Possible keys for assoc include:
  • "Name" string giving the column's name
    "Description" string giving the column's description
    "Type" string giving the column's type
    "MissingValues" values to be considered missing for the column
  • Possible keys for "MetaInformation" include:
  • "Comments" string giving general comments on the file
    "CreationDate" date object giving the creation date of the file
    "ModificationDate" date object giving the modification date of the file
    "TableName" string giving the name of the entire table
    "Version" integer giving the version of the file

Examples

open all close all

Basic Examples  (3)

Import a POR file:

Wolfram Language code: Import["ExampleData/sample.por"]

Summary of a POR file:

Wolfram Language code: Import["ExampleData/sample.por", "Summary"]

Export an array of expressions to a POR file:

Wolfram Language code: file = Export["test.por", {{"String1", DateObject[{2000, 1, 1}, "Day"], Missing["NotAvailable"], 8.25}, {"String2", DateObject[{2000, 1, 2}, "Day"], 0.41, 1.44}, {"String3", DateObject[{2000, 1, 3}, "Day"], Missing["NotAvailable"], Missing["NotAvailable"]}}]

Import the resulting file:

Wolfram Language code: Import[file, "Tabular"]

Scope  (8)

Import  (3)

Import all available elements:

Wolfram Language code: Import["ExampleData/sample.por", "Elements"]

Import data:

Wolfram Language code: Import["ExampleData/sample.por", "Data"]

Import as a Tabular object:

Wolfram Language code: Import["ExampleData/sample.por", "Tabular"]

Export  (5)

Export a Dataset :

Wolfram Language code: dataset = Dataset[{ <|"A" -> 1, "B" -> DateObject[{2000, 1, 1}, "Day"]|>, <|"A" -> 2, "B" -> DateObject[{2000, 1, 2}, "Day"]|>, <|"A" -> 3, "B" -> DateObject[{2000, 1, 3}, "Day"]|>}]
Wolfram Language code: file = Export["test.por", dataset];

Column names are automatically inferred:

Wolfram Language code: Import[file, "Dataset"]

Export an array of data:

Wolfram Language code: file = Export["test.por", {{1, 2, 3}, {4, 5, 6}}]

Column names are automatically generated:

Wolfram Language code: Import[file, "Dataset"]

Export an association of named columns:

Wolfram Language code: file = Export["test.por", <|"A" -> {1, 2, 3}, "B" -> {4, 5, 6}|>]

Column names are automatically inferred:

Wolfram Language code: Import[file, "Dataset"]

Export a TimeSeries :

Wolfram Language code: t = {1, 2, 5, 10, 12, 15}; v = {2, 1, 6, 5, 7, 4};
Wolfram Language code: ts = TimeSeries[v, {t}]
Wolfram Language code: file = Export["test.por", ts]

Times are stored in the first column, values in the second:

Wolfram Language code: Import[file, "Dataset"]

Ragged arrays are automatically padded on the right and converted to full arrays:

Wolfram Language code: file = Export["test.por", {a, {d, e, f}}]
Wolfram Language code: Import[file, "Dataset"]

Import Elements  (18)

Data Representation  (7)

"Data"  (1)

Import a POR file as a 2D list of values:

Wolfram Language code: Import["ExampleData/sample.por", "Data"]

This is also the default element:

Wolfram Language code: Import["ExampleData/sample.por"]

"Dataset"  (1)

Import a POR file as a Dataset :

Wolfram Language code: Import["ExampleData/sample.por", "Dataset"]

"EventSeries"  (1)

Export a Tabular object to a POR file:

Wolfram Language code: file = Export["test.por", Tabular[Association["RawSchema" -> Association["ColumnProperties" -> Association["DATE" -> Association["ElementType" -> TypeSpecifier["Date"]["Integer32", "Day", "Gregorian", 0]], "VALUE" -> Association["ElementType" -> "Real32"]], "KeyColumns" -> None, "Backend" -> "WolframKernel"], "Options" -> {}, "BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable", {{TabularColumn[Association["Data" -> {5, {{NumericArray[{13150, 13151, 13152, 13153, 13156}, "Integer32"], {}, None}}, None}, "ElementType" -> "Date"["Integer32", "Day", "Gregorian", 0]]], TabularColumn[Association["Data" -> {NumericArray[{11.819999694824219, 12.039999961853027, 12.09000015258789, 11.880000114440918, 12.430000305175781}, "Real32"], {}, None}, "ElementType" -> "Real32"]]}}]]]]];

Import a POR file as an EventSeries :

Wolfram Language code: Import[file, "EventSeries"]

"LabeledData"  (1)

Import a POR file as an association of labels and data:

Wolfram Language code: Import["ExampleData/sample.por", "LabeledData"]

"LabeledRawData"  (1)

Import a POR file as an association of labels and raw data:

Wolfram Language code: Import["ExampleData/sample.por", "LabeledRawData"]

"Tabular"  (1)

Import a POR file as a Tabular :

Wolfram Language code: Import["ExampleData/sample.por", "Tabular"]

"TimeSeries"  (1)

Export a Tabular object to a POR file:

Wolfram Language code: file = Export["test.por", Tabular[Association["RawSchema" -> Association["ColumnProperties" -> Association["DATE" -> Association["ElementType" -> TypeSpecifier["Date"]["Integer32", "Day", "Gregorian", 0]], "VALUE" -> Association["ElementType" -> "Real32"]], "KeyColumns" -> None, "Backend" -> "WolframKernel"], "Options" -> {}, "BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable", {{TabularColumn[Association["Data" -> {5, {{NumericArray[{13150, 13151, 13152, 13153, 13156}, "Integer32"], {}, None}}, None}, "ElementType" -> "Date"["Integer32", "Day", "Gregorian", 0]]], TabularColumn[Association["Data" -> {NumericArray[{11.819999694824219, 12.039999961853027, 12.09000015258789, 11.880000114440918, 12.430000305175781}, "Real32"], {}, None}, "ElementType" -> "Real32"]]}}]]]]];

Import a POR file as a TimeSeries :

Wolfram Language code: Import[file, "TimeSeries"]

Data Descriptors  (5)

"ColumnDescriptions"  (1)

Import associations giving the name, description and type for each column in a POR file:

Wolfram Language code: Import["ExampleData/sample.por", "ColumnDescriptions"]

"ColumnLabels"  (1)

Import the names of each column in a POR file:

Wolfram Language code: Import["ExampleData/sample.por", "ColumnLabels"]

"ColumnTypes"  (1)

Import the types of each column in a POR file:

Wolfram Language code: Import["ExampleData/sample.por", "ColumnTypes"]

"MissingPositions"  (1)

Import associations giving the positions of missing values by column:

Wolfram Language code: Import["ExampleData/sample.por", "MissingPositions"]

"MissingValues"  (1)

Import values considered to be missing per column:

Wolfram Language code: Import["ExampleData/sample.por", "MissingValues"]

Metadata  (6)

"Comments"  (1)

Import comments stored in the metadata of a POR file:

Wolfram Language code: Import["ExampleData/sample.por", "Comments"]

"CreationDate"  (1)

Import the creation date:

Wolfram Language code: Import["ExampleData/sample.por", "CreationDate"]

"Dimensions"  (1)

Import the data dimensions:

Wolfram Language code: Import["ExampleData/sample.por", "Dimensions"]

"MetaInformation"  (1)

Import an association of all the metadata stored in a POR file:

Wolfram Language code: Import["ExampleData/sample.por", "MetaInformation"]

"ModificationDate"  (1)

Import the modification date:

Wolfram Language code: Import["ExampleData/sample.por", "ModificationDate"]

"Version"  (1)

Import the version of a POR file:

Wolfram Language code: Import["ExampleData/sample.por", "Version"]

Import Options  (3)

"ColumnDefaultValues"  (1)

Missing numerical values are replaced with zero by default:

Wolfram Language code: Normal[Lookup[Import["ExampleData/sample.por", "LabeledRawData"], {"MISSING", "RANGE"}]]//Function[...]

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

Wolfram Language code: Normal[Lookup[Import["ExampleData/sample.por", "LabeledRawData", "ColumnDefaultValues" -> <|"MISSING" -> -1., "RANGE" -> -10.|>], {"MISSING", "RANGE"}]]//Function[...]

"TimeColumn"  (1)

Export a Tabular object to a POR file:

Wolfram Language code: file = Export["test.por", Tabular[Association["RawSchema" -> Association["ColumnProperties" -> Association["DATE" -> Association["ElementType" -> TypeSpecifier["Date"]["Integer32", "Day", "Gregorian", 0]], "VALUE" -> Association["ElementType" -> "Real32"]], "KeyColumns" -> None, "Backend" -> "WolframKernel"], "Options" -> {}, "BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable", {{TabularColumn[Association["Data" -> {5, {{NumericArray[{13150, 13151, 13152, 13153, 13156}, "Integer32"], {}, None}}, None}, "ElementType" -> "Date"["Integer32", "Day", "Gregorian", 0]]], TabularColumn[Association["Data" -> {NumericArray[{11.819999694824219, 12.039999961853027, 12.09000015258789, 11.880000114440918, 12.430000305175781}, "Real32"], {}, None}, "ElementType" -> "Real32"]]}}]]]]];

By default, the time column is selected automatically for "TimeSeries" and "EventSeries" elements:

Wolfram Language code: Import[file, "TimeSeries"]

Use the "TimeColumn" option to specify the time column:

Wolfram Language code: Import[file, "TimeSeries", "TimeColumn" -> "VALUE"]

"TypeDefaultValues"  (1)

Missing numerical values are replaced with zero by default:

Wolfram Language code: Normal[Lookup[Import["ExampleData/sample.por", "LabeledData"], {"MISSING", "RANGE"}]]//Function[...]

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

Wolfram Language code: Normal[Lookup[Import["ExampleData/sample.por", "LabeledData", "TypeDefaultValues" -> <|"Real64" -> -1.|>], {"MISSING", "RANGE"}]]//Function[...]

Export Options  (2)

"ColumnDescriptions"  (1)

Export different data types:

Wolfram Language code: Export["test.por", {{1, 2., "3"}, {4, 5., "6"}}]

Columns will automatically infer types based on the data given:

Wolfram Language code: Import["test.por", "ColumnDescriptions"]

Use "ColumnDescriptions" to specify column types and descriptions:

Wolfram Language code: Export["test.por", {{1, 2., "3"}, {4, 5., "6"}}, "ColumnDescriptions" -> {<|"Type" -> "String", "Description" -> "String data."|>, <|"MissingValues" -> {2}|>}]

Import the resulting column descriptions:

Wolfram Language code: Import["test.por", "ColumnDescriptions"]

Import the resulting data with missing values:

Wolfram Language code: Import["test.por"]

"MetaInformation"  (1)

Retrieve the metainformation from a POR file:

Wolfram Language code: meta = Import["ExampleData/sample.por", "MetaInformation"]

Export a new file with the same metainformation:

Wolfram Language code: Export["test.por", {{1, 2, 3}, {4, 5, 6}}, "MetaInformation" -> meta]
Wolfram Language code: Import["test.por", "MetaInformation"]

See Also

Import   CloudImport

Formats: XPORT   DTA   SAS7BDAT   SAV

History

Introduced in 2021 (12.3) | Updated in 2021 (13.0) 2022 (13.1) 2025 (14.2) 2026 (15.0)

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /