5.7.5 Subscripted Variables
A subscripted variable is a floating-point, integer, packed
decimal, RFA, or string variable that is part of an array.
Chapter 7 describes arrays in more detail.
An array is a set of data organized in one or more dimen-
sions. A one-dimensional array is called a list or vector . A
two-dimensional array is called a matrix . Arrays can have
up to 32 dimensions.
When you create an array, its size is determined by the
number of dimensions and the maximum size, called the
bound , of each dimension. Subscripts begin by default with
0, not 1. That is, when calculating the number of elements in
a dimension, you count from zero to the bound specified.
The following DECLARE statement creates an 11 by 11 ar-
ray of integers. Therefore, the array contains a total of 121
array elements.
DECLARE INTEGER My_array (10, 10)
There are many applications where you need to reference
data for a particular range of values. You can specify a lower
bound other than zero for your arrays. The following exam-
ple declares an array containing the birth rates for the years
from 1945 to 1985:
OPTION TYPE = EXPLICIT, &
SIZE = REAL SINGLE
DECLARE REAL Birth_rates(1945 TO 1985)
Subscripts define the position of an element in an array; the
expression Birth_rates (1970) refers to the 26th value of the
array Birth_rates . For more information about arrays, see
Chapter 7.