When you specify an
array with an asterisk (*), by default, the lower bound is 1, and
the upper bound is the number of elements in the array. For example,
both the following ARRAY statements have a lower bound of 1 and an
upper bound of 6. The first element is referred to as element 1, and
the second element as 2, and so on.
array years[6] yr2011-yr2016;
array years[*] yr2011-yr2016;
However, for some DATA
step code it might be more efficient if the element number is referenced
by another value. For example, it might be useful to reference the
following element yr2011
as element 2011,
the second as 2012, and so on. To do so, you can specify the lower
and upper bounds using a colon between the two values.
array years[2011:2016] yr2011-yr2016;
do i=2011 to 2016;
When lower and upper
bounds are specified, but the names of the variables are omitted,
SAS does not create variable names with the bound values as the suffix.
The following example creates the variables Years1, Years2, and so
on, with the array. It does not create the variables Years2011, Years2012,
and so on.