Array Indexing
When an array is declared its number of elements (in any given dimension) will be one greater than the number specified. The number specified when an array is dimensioned (or redimensioned) is the last element of the of the array (or array dimension), but the first element is zero. The following example demonstrates this:
Dim AnArray(2) As Integer AnArray(0) = 0 AnArray(1) = 1 AnArray(2) = 2
As you can see, although two was specified in the array declaration, in reality the array will have three elements. The reason for this is because by default all arrays' indices begin at zero. To alter this behavior so that arrays' indices begin at one you must use the declaration Option Base 1 in the Declaration section of your macro. The following example demonstrates this:
Option Base 1 Sub Main
Dim AnArray(2) As Integer 'this next line won't work because the index now begins 'at one, not zero: 'AnArray(0) = 0 AnArray(1) = 1 AnArray(2) = 2
End Sub
See also, How to Specify Arrays in STATISTICA Visual Basic Functions.