Chapter Contents

Previous

Next
COLLATE

COLLATE



Returns an ASCII or EBCDIC collating sequence character string

Category: Character


Syntax
Arguments
Details
Examples
See Also

Syntax

COLLATE (start-position<,end-position>) |
(start-position<,,length>)

Arguments

start-position
specifies the numeric position in the collating sequence of the first character to be returned.
Interaction: If you specify only start-position, COLLATE returns consecutive characters from that position to the end of the collating sequence or up to 255 characters, whichever comes first.

end-position
specifies the numeric position in the collating sequence of the last character to be returned.

The maximum end-position for the EBCDIC collating sequence is 255. For ASCII collating sequences, the characters that correspond to end-position values between 0 and 27 represent the standard character set. Other ASCII characters that correspond to end-position values between 128 and 255 are available on certain ASCII operating environments, but the information those characters represents varies from host environment.
Tip: end-position must be larger than start-position
Tip: If you specify end-position, COLLATE returns all character values in the collating sequence between start-position and end-position, inclusive.
Tip: If you omit end-position and use length, mark the end-position place with a comma.

length
specifies the number of characters in the collating sequence.
Default: 200
Tip: If you omit end-position, use length to specify the length of the result explicitly.


Details

If you specify both end-position and length, COLLATE ignores length. If you request a string longer than the remainder of the sequence, COLLATE returns a string through the end of the sequence.


Examples

SAS Statements Results
ASCII
----+----1----+----2--
x=collate(48,,10);
y=collate(48,57);
put @1 x @14 y;
 

0123456789   0123456789
EBCDIC
x=collate(240,,10);
y=collate(240,249);
put @1 x @14 y;
 

0123456789   0123456789


See Also

Functions:

BYTE
RANK


Chapter Contents

Previous

Next

Top of Page

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