Chapter Contents |
Previous |
Next |
The TRANTAB Procedure |
Understanding Translation Tables and Character Sets |
data _null_; x=rank('a'); put "The position of a is " x ".";
The SAS log prints the following message:
The position of a is 97 .
Each position in a translation table contains a hexadecimal number that is within the range of 0 ('00'x) to 255 ('FF'x). Hexadecimal values always end with an x. You can represent one or more consecutive hexadecimal values within quotation marks followed by a single x. For example, a string of three consecutive hexadecimal values can be written as '08090A'x. The SAS log displays each row of a translation table as 16 hexadecimal values enclosed in quotes followed by an x. The SAS log also lists reference numbers in the vertical and horizontal margins that correspond to the positions in the table. Viewing a Translation Table shows how the SAS log displays a translation table.
Storing Translation Tables |
If you want the translation table you create to be globally accessed, have your SAS Installation Coordinator copy the table from your SASUSER.PROFILE catalog (using the CATALOG procedure) to the SASHELP.HOST catalog.
Modifying Institute-supplied Translation Tables |
proc catalog c=sasuser.profile; copy out=sashelp.host entrytype=trantab; run;
You can use PROC TRANTAB to modify translation tables stored in the SASHELP.HOST catalog only if you have update (or write) access to that data library and catalog.
Using Translation Tables Outside PROC TRANTAB |
proc sort sortseq=ascii;
You can also create a customized translation table with PROC TRANTAB and specify the new table with PROC SORT. This is useful when you want to specify sorting sequences for languages other than U.S. English. The sample program TRABASE from the SAS Sample Library builds transport-format and character-operations translation tables for a number of languages and environments. The NLSSetup Application, shipped with Release 6.11 as part of the SAS Sample Library, provides an easy way to create all the necessary translation tables, device maps, and key maps simply by selecting a country name from a listbox.
See Using Different Translation Tables for Sorting for an example that uses
translation tables to sort data in different ways.
For information on the tables available for sorting and the SORTSEQ= option,
see The SORT Procedure .
Translation tables are operating environment-specific. In most cases, you can simply use the default translation table, SASGTAB0, or one of the Institute-supplied graphics translation tables. However, if these tables are not able to do all of the translation correctly, you can create your own translation table with PROC TRANTAB. The SASGTAB0 table may fail to do the translation correctly when it encounters characters from languages other than U.S. English.
To specify an alternative translation table for
SAS/GRAPH
software, you can either use the TRANTAB= option in a GOPTIONS statement or
modify the TRANTAB device parameter in the device entry. For example, the
following GOPTIONS statement specifies the GTABTCAM graphics translation table:
goptions trantab=gtabtcam;
Translation tables used in SAS/GRAPH software perform both device-to-operating environment translation and operating environment-to-device translation. Therefore, a translation table is made up of 512 bytes, with the first 256 bytes used to perform device-to-operating environment translation (ASCII to EBCDIC on IBM mainframes) and the second 256 bytes used to perform operating environment-to-device translation (EBCDIC to ASCII on IBM mainframes). For PROC TRANTAB, the area of a translation table for device-to-operating environment translation is considered to be table one, and the area for operating environment-to-device translation is considered to be table two. See Viewing a Translation Table for a listing of the ASCII translation table (an Institute-provided translation table), which shows both areas of the table.
On operating environments other than IBM mainframes, translation tables can be used to translate specific characters in the data stream that are created by the driver. For example, if the driver normally generates a vertical bar in the data stream, but you want another character to be generated in place of the vertical bar, you can create a translation table that translates the vertical bar to an alternate character.
For details on how to specify translation tables with the TRANTAB= option
in SAS/GRAPH software, see
SAS/GRAPH Software: Reference,
Version 6, First Edition, Volume 1 and Volume 2.
SAS/GRAPH software also uses key maps and device maps to map codes generated by the keyboard to specified characters and to map character codes to codes required by the graphics output device. These maps are specific to SAS/GRAPH software and are discussed in "The GKEYMAP Procedure" in SAS/GRAPH Software: Reference.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.