Specifies the maximum number of bytes per single character in the database client encoding, which usually matches SAS encoding.
| Valid in: | SAS/ACCESS LIBNAME statement |
|---|---|
| Category: | Data Set Control |
| Aliases: | CLIENT_MAX_BYTES= [Impala] |
| CHARACTER_MULTIPLIER= [Hadoop, JDBC, Spark] | |
| Default: | matches the maximum bytes per single character of SAS session encoding [Amazon Redshift, Aster, Google BigQuery, Greenplum, Hadoop, Impala, JDBC, MySQL, Oracle, PostgreSQL, Snowflake, Spark, Vertica, Yellowbrick] |
| 1 [SAP IQ, Teradata (see specifics in Details)] | |
| 1 for character data, 3 for graphic data types with UTF8 session encoding [DB2] | |
| 3 [SAP HANA] | |
| Restriction: | SAP HANA: This option applies only to NCHAR, NVARCHAR, and NCLOB data types with UTF8 encoding. |
| Interaction: | Hadoop, JDBC, Spark: This option overrides any value that you might have set for the SAS_HADOOP_READ_MULTIPLIER= environment variable. |
| Supports: | NLS |
| Data source: | Amazon Redshift, Aster, DB2 under UNIX and PC Hosts, Google BigQuery, Greenplum, Hadoop, Impala, JDBC, MySQL, Oracle, PostgreSQL, SAP HANA, SAP IQ, Snowflake, Spark, Teradata, Vertica, Yellowbrick |
| Notes: | Support for Yellowbrick was added in SAS 9.4M7. |
| Support for SAP IQ was added in SAS 9.4M8. | |
| Support for SAP HANA was added in the August 2023 update for SAS/ACCESS on SAS 9.4M8. | |
| Support for Greenplum, Hadoop, JDBC, and Spark was added in SAS 9.4M9. | |
| The DBSERVER_MAX_BYTES= LIBNAME option is not supported for Hadoop, JDBC, and Spark. | |
| See: | DBSERVER_MAX_BYTES= LIBNAME option, DBTYPE= data set option, SAS/ACCESS LIBNAME options for NLS |
Table of Contents
specifies the multiplying factor to apply for storage of character data types for client encoding.
When using a multi-byte SAS session encoding, such as UTF8 or EUC-CN, it might be necessary to control the number of bytes that SAS allocates for each character in a double-byte or multi-byte character set. By default, SAS estimates how many bytes per character are required to avoid truncation or transcoding issues. This estimation might lead to overallocation.
For example, if a DBMS system contains single-byte ASCII data, but a column’s character set encoding is UTF8, SAS overallocates space because it assumes that the UTF8 source requires multiple bytes per character. This overallocation can cause an inflation issue when copying data back and forth between SAS data sets and the external DBMS. It can also lead to performance issues because of the additional blank padding that SAS must manage.
To address this situation, set DBCLIENT_MAX_BYTES=1. This tells SAS that the underlying data is encoded in a single-byte encoding.
The default session encoding for SAS Viya is UTF8. However, if SAS is running in a single-byte session encoding, then this option has no effect because SAS is limited to one byte per character by the encoding.
To prevent unwanted data expansion when you write data back to your data source, use the DBSERVER_MAX_BYTES= LIBNAME option, if it is supported for your data source. To write to a data type that differs from the default exported data type, use the DBTYPE= data set option.
DB2: By default, when loading graphic data types into SAS with a UTF8 session encoding, SAS/ACCESS allocates three times the length of the graphic type data. For example, SAS/ACCESS loads data of type GRAPHIC(100) into SAS as CHAR(300). If you specify a value for DBCLIENT_MAX_BYTES=, then that value is used as the multiplier for graphic data types. If you set DBCLIENT_MAX_BYTES=2, then VARGRAPHIC(100) data is loaded into SAS as CHAR(200). If you are not using UTF8 session encoding, then the default value of DBCLIENT_MAX_BYTES= for graphic data types is 1.
SAP HANA:
To ensure that an error is generated in the SAS log if data is truncated, set the
SAS_SAPHANA_EFTCH_INFO_ERROR environment variable to YES, and specify
sastrace=',,d,' and sastraceloc=saslog in
an OPTIONS statement.
Teradata: The DBCLIENT_MAX_BYTES= option is ignored for Teradata columns with a LATIN or UNICODE character set encoding when both the Teradata client encoding and the SAS session encoding are set to UTF8. Ignoring data with the LATIN or UNICODE encodings prevents the possibility of data truncation that is not called out in the SAS log and prevents possible data security issues.
This example shows how to use macro variables in your LIBNAME statement.
%let engine=oracle;
%let connopt=path=myPath user=myUsr1 pw=myPwd1;
libname x5 &engine &connopt
dbclient_max_bytes=3 dbclient_encoding_fixed=yes;
proc contents data=x5.char_sem; run;
proc contents data=x5.nchar_sem; run;
proc contents data=x5.byte_sem; run;
proc contents data=x5.mixed_sem; run;