Chapter Contents

Previous

Next
The TRANTAB Procedure

Example 6: Using Different Translation Tables for Sorting


Procedure features:
PROC SORT statement option:
SORTSEQ=
Other features:
PRINT procedure

This example shows how to specify a different translation table to sort data in an order that is different from the default sort order. Characters that are written in a language other than U.S. English may require a sort order that is different from the default order.

Note:   You can use the TRABASE program in the SAS Sample Library to create translation tables for several different languages.  [cautionend]


Program

options nodate pageno=1 linesize=80 pagesize=60;
 Note about code
data testsort;
   input Values $10.;
   datalines;
Always
always
Forever
forever
Later
later
Yesterday
yesterday
;
 Note about code
proc sort;
   by values;
run;
proc print noobs;
   title 'Default Sort Sequence';
run;


SAS Output
Output from Sorting Values with Default Translation Table

The default sort sequence sorts all the capitalized words in alphabetical order before it sorts any lowercase words.

[HTML Output]
 [Listing Output]
 Note about code
proc sort sortseq=upper;
   by values;
run;
proc print noobs;
   title 'Customized Sort Sequence';
run;


SAS Output
Output from Sorting Values with Customized Translation Table

The customized sort sequence sorts all the words in alphabetical order, without regard for the case of the letters.

[HTML Output]
 [Listing Output]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.