Typically in an ARRAY statement,
the subscript in each dimension of the array ranges from 1 to
n,
where
n is the number of elements
in that dimension. Thus, 1 is the lower bound and
n is
the upper bound of that dimension of the array. For example, in the
following array, the lower bound is 1 and the upper bound is 4:
array new{4} Jackson Poulenc Andrew Parson;
In the following ARRAY
statement, the bounds of the first dimension are 1 and 2 and those
of the second dimension are 1 and 5:
array test{2,5} test1-test10;
Bounded array dimensions
have the following form:
{<lower-1:>upper-1<,…<lower-n:>upper-n>}
Therefore, you can also
write the previous ARRAY statements as follows:
array new{1:4} Jackson Poulenc Andrew Parson;
array test{1:2,1:5} test1-test10;
For most arrays, 1 is
a convenient lower bound, so you do not need to specify the lower
bound. However, specifying both the lower and the upper bounds is
useful when the array dimensions have beginning points other than
1.
In the following example,
ten variables are named Year76 through Year85. The following ARRAY
statements place the variables into two arrays named FIRST and SECOND:
array first{10} Year76-Year85;
array second{76:85} Year76-Year85;
In the first ARRAY
statement, the element first{4} is variable Year79, first{7} is Year82,
and so on. In the second ARRAY statement, element second{79} is Year79
and second{82} is Year82.
To process the array
names SECOND in a DO group, make sure that the range of the DO loop
matches the range of the array as follows:
do i=76 to 85;
if second{i}=9 then second{i}=.;
end;