Chapter Contents

Previous

Next
DELARRAY

DELARRAY



Deletes a dynamic array

Category: Array


Syntax
Details
Examples
Example 1: Create an Array and Delete It
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:

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


Examples

Example 1: Create an Array and Delete It

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

DCL num a(*);
rc = makearray(a,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


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.