Functions and CALL Routines under OpenVMS |
Category: | Character |
OpenVMS specifics: | ASCII collating sequence |
See: | COLLATE Function in SAS Language Reference: Dictionary |
Syntax |
COLLATE(start-position<,end-position>) | (start-position<,,length>) |
specifies the numeric position in the collating sequence of the first character to be returned.
specifies the numeric position in the collating sequence of the last character to be returned.
specifies the number of characters in the collating sequence.
Details |
The COLLATE function returns a string of ASCII characters, which can range in value from 0 to 255. Characters 128 to 255 are usually special control characters such as special fonts, but the COLLATE function returns them.
Unless you assign the return value of the COLLATE function to a variable with a defined length less than 200, the ASCII collating sequence string is padded with blanks to a length of 200. If the ASCII collating sequence is greater than 200 characters, you must specify the length for the return string in a LENGTH statement; otherwise, the returned string will be truncated to a length of 200 characters. For more information, see the following examples.
Examples: How SAS Determines the Length of the Return String |
Because the following code does not include a LENGTH statement, the length attribute for the Address variable is truncated to 200 characters.
data sales; Address=collate(1,241); run; proc contents; run;
Portion of PROC CONTENTS Output
Alphabetic List of Variables and Attributes # Variable Type Len 1 Address Char 200
Because length for Address is limited to 200 characters, the returned string from the COLLATE function will be limited to 200 characters.
To specify a length greater than 200 characters for a specific variable, you can use the LENGTH statement. In the following code, the length of Address is specified as 240 characters.
data sales; length Address $240; Address=collate(1,241); run; proc contents; run;
Portion of PROC CONTENTS Output
Alphabetic List of Variables and Attributes # Variable Type Len 1 Address Char 240
Because the length of Address is set to 240 characters, the returned string from the COLLATE function will contain 240 characters.
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.