Previous Page | Next Page

SAS Component Language Dictionary

DELARRAY



Deletes a dynamic array
Category: Array

Syntax
Details
Example
See Also

Syntax

rc=DELARRAY(array);

rc

indicates whether the operation was successful.

0

successful

[ne]0

not successful

Type: Numeric

array

is the dynamic array to delete. A non-dynamic array causes an error condition.

Type: Array


Details

The DELARRAY function deletes dynamic arrays. An array's contents cannot be accessed after the array is deleted. Dynamic arrays are only accessible within the scope that they are declared. In the following example, array B is not accessible outside of the scope of the DO group:

 DCL num a(*,*) rc;
      a = makearray(5,5);
      do;
         DCL num b(*);
         b = makearray(10);
      end;


Example

This example creates a 1-dimensional array of 3 elements, resizes it to 5 elements (preserving the data), and then deletes the array.

DCL num a(*);
a = makearray(3);
do i=1 to dim(a);
   a[i]=i;
end;
rc = redim(a,5);
put a=;
rc = delarray(a);

The output would be:

a[1]=1
a[2]=2
a[3]=3
a[4]=.
a[5]=.


See Also

COPYARRAY

MAKEARRAY

REDIM

Previous Page | Next Page | Top of Page