Chapter 3

Sort Functions

 

Introduction

Function That Sorts Numeric Values

CALL SORTN

Function That Sorts Character Values

CALL SORTC

 

Introduction

Two CALL routines, CALL SORTN and CALL SORTC, can sort the values of their arguments. They are frequently used with SAS arrays to place all the values of the array elements in ascending order.

These two CALL routines were included in SAS 9.1.3 but were still considered experimental. With SAS 9.2, they are considered fully supported routines.

This author remembers writing a SAS program, many years ago, that used a bubble sort to perform the actions of the CALL SORTN routine. With the introduction of the ORDINAL function, this process became much easier. Finally, with these CALL routines, sorting ...

Get SAS Functions by Example, Second Edition, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.