SUB_CHAR= LIBNAME Statement Option

Specifies a substitution character to use in place of any invalid characters that cannot be represented in the SAS session encoding.

Valid in: SAS/ACCESS LIBNAME statement
Category: Data Set Control
Aliases: SUBCHAR=
SUBSTITUTION_CHAR=
Default: none
Interaction: This option can be used with the BULKUNLOAD= LIBNAME option.
Data source: Amazon Redshift, Greenplum, Hadoop, HAWQ, Impala, JDBC, Netezza, PostgreSQL, SAP HANA, Spark, Vertica
Notes: Support for this option was added in SAS 9.4M6.
Support for Greenplum, HAWQ, Impala, SAP HANA, and Vertica was added in SAS Viya 3.5.
Support for the QUESTIONMARK value was added in SAS 9.4M7 and SAS Viya 3.5.
Support for Hadoop, JDBC, and Spark was added in SAS 9.4M7.
See: BULKUNLOAD= LIBNAME option

Table of Contents

Syntax

SUB_CHAR=value

Syntax Description

value

specifies the substitution character to use in place of a character that cannot be represented in the SAS session encoding.

Here are the possible values for this option:

QUESTIONMARK specifies that a question mark symbol (?) replaces an invalid character during transcoding.
SPACE specifies that a space replaces an invalid character during transcoding.
SUB specifies that the default substitution character for the target encoding replaces an invalid character during transcoding. The default substitution character varies depending on your SAS session encoding. The default could be one of the following: 0x1A (ASCII), 0x3F (EBCDIC), 0xFFFD (UNICODE), or 0xEFBFBD (UTF8).
UESC specifies that the ‘\uddd’ value replaces an invalid character during transcoding. This UESC value is typically used only during debugging and is not intended to be used for large-scale jobs.

Details

This option applies only when SAS/ACCESS transcodes the data into the SAS session encoding when retrieving data into SAS. If your data is transcoded by your DBMS client to the SAS session encoding before loading data into SAS, then this option is not used.

The default SAS session encoding is UTF8. If your data must be transcoded from another encoding to the SAS session encoding and if your data contains characters that cannot be transcoded to the destination encoding, then warnings are generated in the SAS log.

To see details about the rows and columns that are affected by transcoding errors, specify the SASTRACE= option:

options sastrace=',,,d';
Last updated: February 3, 2026