Functions for NLS |
Category: | DBCS |
Syntax | |
Arguments | |
Details | |
Example |
Syntax |
str=KPROPDATA(<instr>(<option, input encode name, output encode name>)) |
data string that has been converted and is in session encoding.
input data string.
specifies instructions on processing unprintable characters:
Converts unprintable characters using a Unicode escaped string (for example, \u0000\u1234).
Removes unprintable characters. No replacement character is used.
Replaces each unprintable character with a single-byte blank.
Replaces unprintable characters with a single-byte '?'.
Replaces unprintable characters with a hexadecimal representation (for example, 0x810x82).
Truncates the data string when the first unprintable character is encountered.
Removes the data string if any unprintable characters are found.
Encodes the unprintable characters using NCR representation if the code is available in Unicode.
specifies the input data's encoding name if necessary. If the input encode name is not specified, then the KPROPDATA function processes the data as the current SAS session encoded string. For information on SAS encoding names, see SBCS, DBCS, and Unicode Encoding Values for Transcoding Data.
specifies the output data's encoding name. If the encoding name is not specified, the KPROPDATA function recognizes the output as the current SAS session encoding. For information on SAS encoding names, see SBCS, DBCS, and Unicode Encoding Values for Transcoding Data.
Details |
This function converts the input data string to the current SAS session encoding and removes or replaces unprintable characters based on the options.
Example |
The following example demonstrates the functionality of the KPROPDATA function:
length instr $12; length str1 str2 str3 str4 str5 str6 str7 str8 str9 str10$ 50; instr = "534153"x||"ae"x || " System"; put instr; str1 = kpropdata(instr); put str1= +2 str1= $hex26.; str2 = kpropdata(instr,'UESC'); put str2= +2 str2= $hex26.;; str3 = kpropdata(instr, 'UESC','wlatin1'); put str3= +2 str3= $hex34.; str4 = kpropdata(instr,'TRIM','wlatin1'); put str4= +2 str4= $hex26.; str5 = kpropdata(instr,'BLANK', 'wlatin1'); put str5= +2 str5= $hex26.; str6 = kpropdata(instr,'?', 'wlatin1'); put str6= +2 str6= $hex26.; str7 = kpropdata(instr,'hex', 'wlatin1'); put str7= +2 str7= $hex26.; str8 = kpropdata(instr,'TRUNC', 'wlatin1'); put str8= +2 str8= $hex26.; str9 = kpropdata(instr,'REMOVE', 'wlatin1'); put str9= +2 str9= $hex26.; str10 = kpropdata(instr,'NCR', 'wlatin1'); put str10= +2 str10= $hex26.; RESULTS: SAS? System str1=SAS? System str1=534153AE2053797374656D2020 str2=SAS? System str2=534153AE2053797374656D2020 str3=SAS\uff6e System str3=5341535C75666636652053797374656D20 str4=SAS System str4=5341532053797374656D202020 str5=SAS System str5=534153202053797374656D2020 str6=SAS? System str6=5341533F2053797374656D2020 str7=SAS\xAE System str7=5341535C784145205379737465 str8=SAS str8=53415320202020202020202020 str9= str9=20202020202020202020202020 str10=SAS® System str10=53415326233137343B20537973
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.