02.05.2013 Views

SAS(R) 9.1.3 Companion for z/OS

SAS(R) 9.1.3 Companion for z/OS

SAS(R) 9.1.3 Companion for z/OS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

338 SORT Procedure Chapter 16<br />

CAUTION:<br />

If you are using a host sort utility to sort your data, then specifying the SORTSEQ= option<br />

might corrupt the character BY variables if the sort sequence translation table and its<br />

inverse are not one-to-one mappings. In other words, <strong>for</strong> the sort to work the<br />

translation table must map each character to a unique weight, and the inverse table<br />

must map each weight to a unique character variable. R<br />

If your translation tables do not map one-to-one, then you can use one of the<br />

following methods to per<strong>for</strong>m your sort:<br />

3 create a translation table that maps one-to-one. Once you create a translation table<br />

that maps one-to-one, you can easily create a corresponding inverse table using<br />

the TRANTAB procedure. If your table is not mapped one-to-one, then you will<br />

receive the following note in the <strong>SAS</strong> log when you try to create an inverse table:<br />

NOTE: This table cannot be mapped one to one.<br />

For more in<strong>for</strong>mation, see “The TRANTAB Procedure” in the Base <strong>SAS</strong> Procedures<br />

Guide.<br />

3 use the <strong>SAS</strong> sort. You can specify the <strong>SAS</strong> sort using the SORTPGM system<br />

option. For more in<strong>for</strong>mation, see “SORTPGM= System Option” on page 507.<br />

3 specify the collation order options of your host sort utility. See the documentation<br />

<strong>for</strong> your host sort utility <strong>for</strong> more in<strong>for</strong>mation.<br />

3 create a view with a dummy BY variable. For an example, see “Example: Creating<br />

a View with a Dummy BY Variable” on page 338.<br />

Note: After using one of these methods, you might need to per<strong>for</strong>m subsequent BY<br />

processing using either the NOTSORTED option or the NOBYSORTED system option.<br />

For more in<strong>for</strong>mation on the NOTSORTED option, see “BY Statement” in <strong>SAS</strong><br />

Language Reference: Dictionary. For more in<strong>for</strong>mation on the NOBYSORTED system<br />

option, see “BYSORTED System Option” in <strong>SAS</strong> Language Reference: Dictionary. R<br />

Example: Creating a View with a Dummy BY Variable The following code is an<br />

example of creating a view using a dummy BY variable:<br />

options sortpgm=host msglevel=i;<br />

data one;<br />

input name $ age;<br />

datalines;<br />

anne 35<br />

ALBERT 10<br />

JUAN 90<br />

janet 5<br />

bridget 23<br />

BRIAN 45<br />

;<br />

data oneview / view=oneview;<br />

set one;<br />

name1=upcase(name);<br />

run;<br />

proc sort data=oneview out=final(drop=name1);<br />

by name1;<br />

run;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!