Chapter Contents |
Previous |
Next |
HBOUND |
Category: | Array |
Syntax | |
Arguments | |
Details | |
Comparisons | |
Examples | |
Example 1: One-dimensional Array | |
Example 2: Multidimensional Array | |
See Also |
Syntax |
HBOUND<n>(array-name) |
HBOUND(array-name,bound-n) |
Details |
The HBOUND function returns the upper bound of a one-dimensional array or the upper bound of a specified dimension of a multidimensional array. Use HBOUND in array processing to avoid changing the upper bound of an iterative DO group each time you change the bounds of the array. HBOUND and LBOUND can be used together to return the values of the upper and lower bounds of an array dimension.
Comparisons |
Note: This distinction
is important when the lower bound of an array dimension has a value other
than 1 and the upper bound has a value other than the total number of elements
in the array dimension.
Examples |
In this example, HBOUND returns the upper bound of the dimension, a value of 5. Therefore, SAS repeats the statements in the DO loop five times.
array big{5} weight sex height state city; do i=1 to hbound(big5); more SAS statements; end;
This example shows two ways of specifying the HBOUND function for multidimensional arrays. Both methods return the same value for HBOUND, as shown in the table that follows the SAS code example.
array mult{2:6,4:13,2} mult1-mult100;
Syntax | Alternative Syntax | Value |
---|---|---|
HBOUND(MULT) | HBOUND(MULT,1) | 6 |
HBOUND2(MULT) | HBOUND(MULT,2) | 13 |
HBOUND3(MULT) | HBOUND(MULT,3) | 2 |
See Also |
Functions:
| |||||
Statements:
| |||||
"Array Processing " in SAS Language Reference: Concepts |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.