Data Types for SAS Data Sets

The following table lists the data type support for a SAS data set.
The BINARY and VARBINARY data types are not supported for data type definition.
For some data type definitions, the data type is mapped to CHAR, which is a Base SAS character data type, or DOUBLE, which is a Base SAS numeric data type. For data source-specific information about the SAS numeric and SAS character data types, see SAS Language Reference: Concepts.
Data Types for SAS Data Sets
Data Type Definition Keyword 1
SAS Data Set Data Type
Description
Data Type Returned
BIGINT2
DOUBLE
64-bit double precision, floating-point number.
Note: There is potential for loss of precision.
DOUBLE
CHAR(n)
CHAR(n)
Fixed-length character string.
Note: Cannot contain ANSI SQL null values.
CHAR(n)
DATE 3
DOUBLE
64-bit double precision, floating-point number. By default, applies the DATE9 SAS format.
DOUBLE
DECIMAL|NUMERIC(p,s)2
DOUBLE
64-bit double precision, floating-point number.
DOUBLE
DOUBLE2
DOUBLE
64-bit double precision, floating-point number.
DOUBLE
FLOAT(p)2
DOUBLE
64-bit double precision, floating-point number.
DOUBLE
INTEGER2
DOUBLE
64-bit double precision, floating-point number.
DOUBLE
NCHAR(n)
CHAR(n)
Fixed-length character string. By default, sets the encoding to Unicode UTF-8. 4
CHAR(n)
NVARCHAR(n)
CHAR(n)
Fixed-length character string. By default, sets the encoding to Unicode UTF-8. 4
CHAR(n)
REAL2
DOUBLE
64-bit double precision, floating-point number.
DOUBLE
SMALLINT2
DOUBLE
64-bit double precision, floating-point number.
DOUBLE
TIME(p)3
DOUBLE
64-bit double precision, floating-point number. By default, applies the TIME8 SAS format.
DOUBLE
TIMESTAMP(p)3
DOUBLE
64-bit double precision, floating-point number. By default, applies the DATETIME19.2 SAS format.
DOUBLE
TINYINT2
DOUBLE
64-bit double precision, floating-point number.
DOUBLE
VARCHAR(n)
CHAR(n)
Fixed-length character string.
Note: Cannot contain ANSI SQL null values.
CHAR(n)
1The CT_PRESERVE= connection argument, which controls how data types are mapped, can affect whether a data type can be defined. The values FORCE (default) and FORCE_COL_SIZE do not affect whether a data type can be defined. The values STRICT and SAFE can result in an error if the requested data type is not native to the data source, or the specified precision or scale is not within the data source range.
2Do not apply date and time SAS formats to a numeric data type. For date and time values, use the DATE, TIME, or TIMESTAMP data types.
3Because the values are stored as a double precision, floating-point number, you can use the values in arithmetic expressions.
4UTF-8 is an MBCS encoding. Depending on the operating environment, UTF-8 characters are of varying width, from one to four bytes. The value for n, which is the maximum number of multibyte characters to store, is multiplied by the maximum length for the operating environment. Note that when you are transcoding, such as from UTF-8 to Wlatin2, the variable lengths (in bytes) might not be sufficient to hold the values, and the result is character data truncation.
Last updated: February 23, 2017