Array Processing |
To define a simple or a multidimensional array, use the ARRAY statement. The ARRAY statement has the following form:
ARRAY array-name {number-of-elements} <$> <length> <array-elements> <(initial-value-list)>; |
is the number of variables in the group. You must enclose this value in either parentheses (), braces {}, or brackets [].
specifies that the elements in the array are character elements.
specifies the length of the elements in the array that have not been previously assigned a length.
is a list of the names of the variables in the group. All variables that are defined in a given array must be of the same type, either all character or all numeric.
is a list of the initial values for the corresponding elements in the array.
For complete information about the ARRAY statement, see SAS Language Reference: Dictionary.
To reference an array that was previously defined in the same DATA step, use an Array Reference statement. An array reference has the following form:
array-name {subscript} |
is the name of an array that was previously defined with an ARRAY statement in the same DATA step.
specifies the subscript, which can be a numeric constant, the name of a variable whose value is the number, a SAS numeric expression, or an asterisk (*).
Note: Subscripts in SAS are 1-based by default, and not 0-based as they are in some other programming languages.
For complete information about the Array Reference statement, see SAS Language Reference: Dictionary.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.