29.12.2013 Views

Base SAS 9.1.3 Procedures Guide - Acsu Buffalo

Base SAS 9.1.3 Procedures Guide - Acsu Buffalo

Base SAS 9.1.3 Procedures Guide - Acsu Buffalo

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.

1017<br />

CHAPTER<br />

44<br />

The SORT Procedure<br />

Overview: SORT Procedure 1017<br />

What Does the SORT Procedure Do? 1017<br />

Sorting <strong>SAS</strong> Data Sets 1018<br />

Syntax: SORT Procedure 1019<br />

PROC SORT Statement 1019<br />

BY Statement 1026<br />

Concepts: SORT Procedure 1027<br />

Multi-threaded Sorting 1027<br />

Using PROC SORT with a DBMS 1027<br />

Sorting Orders for Numeric Variables 1028<br />

Sorting Orders for Character Variables 1028<br />

Default Collating Sequence 1028<br />

EBCDIC Order 1028<br />

ASCII Order 1028<br />

Specifying Sorting Orders for Character Variables 1029<br />

Stored Sort Information 1029<br />

Integrity Constraints: SORT Procedure 1029<br />

Results: SORT Procedure 1030<br />

Procedure Output 1030<br />

Output Data Set 1030<br />

Examples: SORT Procedure 1031<br />

Example 1: Sorting by the Values of Multiple Variables 1031<br />

Example 2: Sorting in Descending Order 1033<br />

Example 3: Maintaining the Relative Order of Observations in Each BY Group 1035<br />

Example 4: Retaining the First Observation of Each BY Group 1037<br />

Overview: SORT Procedure<br />

What Does the SORT Procedure Do?<br />

The SORT procedure orders <strong>SAS</strong> data set observations by the values of one or more<br />

character or numeric variables. The SORT procedure either replaces the original data<br />

set or creates a new data set. PROC SORT produces only an output data set. For more<br />

information, see “Procedure Output” on page 1030.<br />

Operating Environment Information: The sorting capabilities that are described in this<br />

chapter are available for all operating environments. In addition, if you use the HOST<br />

value of the <strong>SAS</strong> system option SORTPGM=, you might be able to use other sorting<br />

options that are available only for your operating environment. Refer to the <strong>SAS</strong>

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

Saved successfully!

Ooh no, something went wrong!