The MCMC Procedure

 
ARRAY Statement

ARRAY arrayname <{ dimensions }> <$> <variables and constants> ;

The ARRAY statement associates a name (of no more than eight characters) with a list of variables and constants. The ARRAY statement is similar to, but not the same as, the ARRAY statement in the DATA step, and it is the same as the ARRAY statements in the NLIN, NLP, NLMIXED, and MODEL procedures. The array name is used with subscripts in the program to refer to the array elements, as illustrated in the following statements:

array r[8] r1-r8;
 
do i = 1 to 8;
   r[i] = 0;
end;

The ARRAY statement does not support all the features of the ARRAY statement in the DATA step. Implicit indexing of variables cannot be used; all array references must have explicit subscript expressions. Only exact array dimensions are allowed; lower-bound specifications are not supported. A maximum of six dimensions is allowed.

Both variables and constants can be array elements. Constant array elements cannot have values assigned to them while variables can. Both the dimension specification and the list of elements are optional, but at least one must be specified. When the list of elements is not specified or fewer elements than the size of the array are listed, array variables are created by appending element numbers to the array name to complete the element list. You can index array elements by enclosing a subscript in braces or brackets , but not in parentheses . The parentheses are reserved for function calls only.

For example, the following statement names an array day:

array day[365];

By default, the variables names are day1 to day365. However, since day is a SAS function, any subscript that uses parentheses gives you the wrong results. The expression day(4) returns the value and does not reference the array element day4.