LBOUND Function


LBOUND Function

Returns the lower bound of an array

Category: Array

Syntax

LBOUND < n >( array- name )

LBOUND ( array-name , bound-n )

Arguments

n

  • specifies the dimension for which you want to know the lower bound. If no n value is specified, the LBOUND function returns the lower bound of the first dimension of the array.

array-name

  • specifies the name of an array defined previously in the same DATA step.

bound-n

  • specifies the dimension for which you want to know the lower bound. Use bound-n only if n is not specified.

Details

The LBOUND function returns the lower bound of a one-dimensional array or the lower bound of a specified dimension of a multidimensional array. Use LBOUND in array processing to avoid changing the lower bound of an iterative DO group each time you change the bounds of the array. LBOUND and HBOUND can be used together to return the values of the lower and upper bounds of an array dimension.

Examples

Example 1: One-dimensional Array

In this example, LBOUND returns the lower bound of the dimension, a value of 2. SAS repeats the statements in the DO loop five times.

 array big{2:6} weight sex height state city;  do i=lbound(big) to hbound(big);     ...  more SAS statements  ...;  end; 

Example 2: Multidimensional Array

This example shows two ways of specifying the LBOUND function for multidimensional arrays. Both methods return the same value for LBOUND, as shown in the table that follows the SAS code example.

 array mult{2:6,4:13,2} mult1-mult100; 

Syntax

Alternative Syntax

Value

LBOUND(MULT)

LBOUND(MULT,1)

2

LBOUND2(MULT)

LBOUND(MULT,2)

4

LBOUND3(MULT)

LBOUND(MULT,3)

1

See Also

Functions:

  • 'DIM Function' on page 499

  • 'HBOUND Function' on page 577

Statements:

  • 'ARRAY Statement' on page 1100

  • 'Array Reference Statement' on page 1105

'Array Processing' in SAS Language Reference: Concepts




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net