Previous Page | Next Page

Encoding for NLS

Setting the Encoding of a SAS Session

You can set the session encoding by using the ENCODING= system option, the DBCS options, or the LOCALE= system option.

Note:   Values for the ENCODING= system option depend on the operating environment.  [cautionend]

The priority order for setting the encoding is as follows:

  1. ENCODING= system option

    The SAS session encoding is determined by the ENCODING= option regardless of whether the DBCS or LOCALE= options are specified. If the ENCODING= option is specified, a set of valid DBCS options are set regardless of whether the user has specified those options. Also, if the ENCODING= option is specified, the LOCALE= option is set to an appropriate value unless a value has been specified by the user.

    Note:   If the ENCODING= option is specified, the TRANTAB= option is implicitly set.  [cautionend]

  2. DBCS options

    If the ENCODING= option is not specified, the SAS session encoding is determined by the DBCS options regardless of whether the LOCALE= option is specified. The LOCALE= option is set to an appropriate value unless a value has been specified by the user.

    The encoding is determined by the values of the DBCSLANG and DBCSTYPE options for DBCS languages, such as Japanese, Korean, Simplified Chinese, and Traditional Chinese.

    The DBCS options are valid only when the DBCS extension directory is included in the path option list. The path of the DBCS extension dynamic link library (DLLs) has to be located at the top of the pathname list of the path option for the DBCS languages when you want to invoke a DBCS SAS session. The DBCS extension DLLs are located in the directory!SASROOT/dbcs/sasexe by default.

    Also you might have to specify the resourcesloc, msg, and sashelp options to use localized resources even if the SAS session encoding is not a DBCS language (for example, Polish, German, and French). The localized resources are located under!SASROOT/nls/<language identifier>/<sasmsg, sashelp, sasmacro, resource>. The values for language identifiers are: cs, de, en, es, fr, hu, it, ja, ko, pl, ru, sv, zh, and zt.

    You can specify a sasv9.cfg file located in the localized directories such as !SASROOT/nls/<language identifier> so that you do not have to consider using the path, resourcesloc, sasmsg, and sashelpoptions.

    If DBCS (which specifies that SAS process DBCS encodings) is specified, DBCSLANG= and DBCSTYPE= options are implicitly set. The default values for DBCSTYPE= and DBCSLANG= match those values for the Japanese environment on the host.

  3. LOCALE= system option

    The SAS session encoding is determined by the LOCALE= option and the platform, if the ENCODING= or DBCS options are not specified.

    The following example shows that encoding is explicitly set by default for the Spanish_Spain locale:

    sas9 -locale Spanish_Spain

    The wlatin1 encoding is the default encoding for the Spanish_Spain locale.

    The following example shows that the wlatin2 encoding is set explicitly when SAS is invoked:

    sas9 -encoding wlatin2

    Note:   Setting DBCS encodings, DBCS options, or a CJK locale on SAS if the DBCS extensions are not available will fail to successfully invoke SAS.   [cautionend]

    Note:   Changing the encoding for a SAS session does not affect SAS keywords or SAS log output, which remain in English.  [cautionend]

In Default Encoding Values Based on the LOCALE= Option, the following values for the CJK locales are based on locale and platform:

Default Encoding Values Based on the LOCALE= Option
Locales WIN (sas4) MVS (sas4) UNX (sas4)
zh_TW

zh_HK

zh_MO

MS-950 (ywin) IBM-937 (yibm) sax, s64: EUC-TW (yeuc)

others: MS-950 (ywin)

zh_CN

zh_SG

EUC-CN (zeuc) IBM-935 (zibm) EUC-CN (zeuc)
ja_JP SHIFT-JIS (sjis) IBM-939 (jibm) h64, h6i, r64: SHIFT-JIS (sjis)

others: EUC-JP (jeuc)

ko_KR EUC-KR (keuc) IBM-933 (kibm) EUC-KR (keuc)

Previous Page | Next Page | Top of Page