SAS7BDAT (.sas7bdat)
Background & Context
-
- MIME type: application/x-sas-data
- SAS database transport format.
- Legacy data exchange format.
- Stores numerical datasets in a portable format.
- Binary format.
- Developed in the late 1980s by SAS Institute.
Import
- Import["file.sas7bdat"] imports a SAS7BDAT file, returning all datasets arranged as a table.
- SAS7BDAT data is represented in the Wolfram Language by real or integer numbers, strings, Boolean values True and False, and DateObject specifications.
- Import["file.sas7bdat",elem] imports the specified element from a SAS7BDAT file.
- Import["file.sas7bdat",{elem,suba,subb,…}] imports a subelement.
- The import format can be specified with Import["file","SAS7BDAT"] or Import["file",{"SAS7BDAT",elem,…}].
- Export["file.sas7bdat",expr] creates a SAS7BDAT 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 a TemporalData object Dataset[…] a dataset <"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 single‐precision numbers "Real64" IEEE double‐precision 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 "LabeledData" association of labels and data - Import by default uses the "Data" element.
- Data descriptor elements:
-
"ColumnDescriptions" 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" Automatic association of column names and default values "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 - 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 allclose allBasic Examples (3)
Scope (6)
Export a Dataset:
Column names are automatically inferred:
Export an association of named columns:
Column names are automatically inferred:
Export a TimeSeries:
Times are stored in the first column, values in the second:
Ragged arrays are automatically padded on the right and converted to full arrays:
Import Elements (15)
Data Representation (3)
"Dataset" (1)
Import a SAS7BDAT file as a Dataset: