Previous Page | Next Page

Functions for NLS

KCVT Function



Converts data from one type of encoding data to another encoding data.
Category: Character
Restriction: I18N Level 2

Syntax
Arguments
Details
Example
See Also

Syntax

KCVT(text, intype, outtype, <options,...>)


Arguments

text

specifies the character variable to be converted.

intype

specifies the encoding of the data. The encoding of the text must match the input data's encoding. For valid values, see SBCS, DBCS, and Unicode Encoding Values for Transcoding Data.

Note:   ASCIIANY and EBCIDICANY are invalid encoding values.  [cautionend]

outtype

specifies the encoding to be converted into character data. For valid values seeSBCS, DBCS, and Unicode Encoding Values for Transcoding Data.

Note:   ASCIIANY and EBCIDICANY are invalid encoding values.  [cautionend]

options

specifies character data options. Here are the available options:

NOSOSI | NOSHIFT

No shift code or Hankaku characters.

INPLACE

Replaces character data by conversion. The INPLACE option is specified to secure the same location between different hosts whose lengths of character data are not identical. For example, the INPLACE option converts data from the host which requires Shift-Codes, into the other host, which does not require shift codes. Truncation occurs when the length of the character data that is converted into outtype for Shift-Codes is longer than the length that is specified in intype.

KANA

Includes Hankaku katakana characters in columns of character data.

UPCASE

Converts 2-byte alphabet to uppercase characters.

LOWCASE

Converts 2-byte alphabet to lowercase characters.

KATA2HIRA

Converts katakana data to Hiragana.

HIRA2KATA

Converts Hiragana data to katakana.


Details

The KCVT function converts SBCS, DBCS, and MBCS character strings into encoding data. For example, the KCVT function can convert: ASCII code data to UCS2 encoding data, Greek code data to UTF-8, and Japanese SJIS code data to another Japanese code data. You can specify the following types for Intype and Outtype options: UCS2, UCS2L, UCS2B, and UTF8. To enable the DBCS mode, specify the following SAS options in the configuration file or in the command line.


Example

The following code converts IBM PC codes into DEC codes for the external text file specified as my-input-file, and writes in OUTDD.

 data _null_;
    infile 'my-input-file';
    file outdd noprint;
    input @1 text $char80.;
    text = kcvt(text, 'pcibm', 'dec');
    put @1 text $char80.;
 run; 


See Also

System options:

DBCS System Option: UNIX, Windows, and z/OS

DBCSLANG System Option: UNIX, Windows, and z/OS

DBCSTYPE System Option: UNIX, Windows, and z/OS

Procedure:

The DBCSTAB Procedure

Previous Page | Next Page | Top of Page