TRANTAB Procedure
Example 2: Creating a Translation Table
Features: |
- Procedures features::
- LIST statement
- REPLACE statement
- SAVE statement
|
This example uses PROC
TRANTAB to create a customized translation table. All examples were
produced in the UNIX environment.
Set the system options and specify the translation table
to edit.
options nodate pageno=1 linesize=80
pagesize=60;
proc trantab table=newtable;
Replace characters in the translation table starting at
a specified position. The REPLACE statement
places the values in the table starting at position 0. You can use
hexadecimal strings of any length in the REPLACE statement. This example
uses strings of length 16 to match the way that translation tables
appear in the SAS log.
replace 0
'00010203a309e57ff9ecc40b0c0d0e0f'x
'10111213a5e008e71819c6c51c1d1e1f'x
'c7fce9e2e40a171beaebe8efee050607'x
'c9e616f4f6f2fb04ffd6dca2b6a7501a'x
'20e1edf3faf1d1aababfa22e3c282b7c'x
'265facbdbca1abbb5f5f21242a293bac'x
'2d2f5fa6a6a6a62b2ba6a62c255f3e3f'x
'a62b2b2b2b2b2b2d2d603a2340273d22'x
'2b6162636465666768692d2ba6a62b2b'x
'2d6a6b6c6d6e6f7071722da62d2b2d2d'x
'2d7e737475767778787a2d2b2b2b2b2b'x
'2b2b2b5f5fa65f5f5fdf5fb65f5fb55f'x
'7b4142434445464748495f5f5f5f5f5f'x
'7d4a4b4c4d4e4f5051525f5f5fb15f5f'x
'5c83535455565758595a5f5ff75f5fb0'x
'30313233343536373839b75f6eb25f5f'x
;
Save the table. The SAVE
statement saves the table under the name that is specified in the
PROC TRANTAB statement. By default, the table is saved in your SASUSER.PROFILE
catalog.
Display both halves of the translation table in the SAS
log. The LIST BOTH statement displays
both the table that provides the translation and the table that provides
the inverse translation.
SAS Log
-->Create
and edit table 2. Table 2 is
empty; that is, it
consists entirely of 0s. To create table 2, you can use the INVERSE statement.
(See
.) To edit table 2, you can use the SWAP statement with the REPLACE statement.
(See
.)" commented-out by old2new conversion -->
NOTE: Table specified is NEWTABLE.
WARNING: Table NEWTABLE not found! New table is assumed.
NOTE: NEWTABLE table 1 is uninitialized.
NOTE: NEWTABLE table 2 is uninitialized.
NOTE: Saving table NEWTABLE.
NOTE: NEWTABLE table 2 will not be saved because it is uninitialized.
NEWTABLE table 1:
0 1 2 3 4 5 6 7 8 9 A B C D E F
00 '00010203A309E57FF9ECC40B0C0D0E0F'x
10 '10111213A5E008E71819C6C51C1D1E1F'x
20 'C7FCE9E2E40A171BEAEBE8EFEE050607'x
30 'C9E616F4F6F2FB04FFD6DCA2B6A7501A'x
40 '20E1EDF3FAF1D1AABABFA22E3C282B7C'x
50 '265FACBDBCA1ABBB5F5F21242A293BAC'x
60 '2D2F5FA6A6A6A62B2BA6A62C255F3E3F'x
70 'A62B2B2B2B2B2B2D2D603A2340273D22'x
80 '2B6162636465666768692D2BA6A62B2B'x
90 '2D6A6B6C6D6E6F7071722DA62D2B2D2D'x
A0 '2D7E737475767778787A2D2B2B2B2B2B'x
B0 '2B2B2B5F5FA65F5F5FDF5FB65F5FB55F'x
C0 '7B4142434445464748495F5F5F5F5F5F'x
D0 '7D4A4B4C4D4E4F5051525F5F5FB15F5F'x
E0 '5C83535455565758595A5F5FF75F5FB0'x
F0 '30313233343536373839B75F6EB25F5F'x
NOTE: NEWTABLE table 2 is uninitialized.
NEWTABLE table 2:
0 1 2 3 4 5 6 7 8 9 A B C D E F
00 '00000000000000000000000000000000'x
10 '00000000000000000000000000000000'x
20 '00000000000000000000000000000000'x
30 '00000000000000000000000000000000'x
40 '00000000000000000000000000000000'x
50 '00000000000000000000000000000000'x
60 '00000000000000000000000000000000'x
70 '00000000000000000000000000000000'x
80 '00000000000000000000000000000000'x
90 '00000000000000000000000000000000'x
A0 '00000000000000000000000000000000'x
B0 '00000000000000000000000000000000'x
C0 '00000000000000000000000000000000'x
D0 '00000000000000000000000000000000'x
E0 '00000000000000000000000000000000'x
F0 '00000000000000000000000000000000'x
Copyright © SAS Institute Inc. All rights reserved.