Data Types and the SAS_PUT() Function

The SAS_PUT() function supports direct use of the Teradata data types shown in Teradata Data Types Supported by the SAS_PUT() Function. In some cases, the Teradata database performs an implicit conversion of the input data to the match the input data type that is defined for the SAS_PUT() function. For example, all compatible numeric data types are implicitly converted to FLOAT before they are processed by the SAS_PUT() function.
Teradata Data Types Supported by the SAS_PUT() Function
Type of Data
Data Type
Numeric
BYTEINT
SMALLINT
INTEGER
BIGINT1
DECIMAL (ANSI NUMERIC)1
FLOAT (ANSI REAL or DOUBLE PRECISION)
Date and time
DATE
TIME
TIMESTAMP
Character23
CHARACTER4
VARCHAR
LONG VARCHAR
1Numeric precision might be lost when inputs are implicitly converted to FLOAT before they are processed by the SAS_PUT() function.
2Only the Latin-1 character set is supported for character data. UNICODE is not supported at this time.
3When character inputs are larger than 256 characters, the results depend on the session mode associated with the Teradata connection.
4The SAS_PUT() function has a VARCHAR data type for its first argument when the value passed has a data type of CHARACTER. Therefore, columns with a data type of CHARACTER have their trailing blanks trimmed when converting to a VARCHAR data type.
The SAS_PUT() function does not support direct use of the Teradata data types shown in Teradata Data Types Not Supported by the SAS_PUT() Function. In some cases, unsupported data types can be explicitly converted to a supported type by using SAS or SQL language constructs. For information about performing explicit data conversions, see the topic on data types for Teradata in SAS/ACCESS for Relational Databases: Reference and your Teradata documentation.
Teradata Data Types Not Supported by the SAS_PUT() Function
Type of Data
Data Type
ANSI date and time
INTERVAL
TIME WITH TIME ZONE
TIMESTAMP WITH TIME ZONE
GRAPHIC server character set
GRAPHIC
VARGRAPHIC
LONG VARGRAPHIC
Binary and large object
CLOB
BYTE
VARBYTE
BLOB
If an incompatible data type is passed to the SAS_PUT() function, various error messages can appear in the SAS log including the following messages:
  • Function SAS_PUT does not exist
  • Data truncation
  • SQL syntax error near the location of the first argument in the SAS_PUT function call