Chapter Contents

Previous

Next
COMPAREARRAY

COMPAREARRAY



Allows you to compare two arrays for size and data equality

Category: Array


Syntax
Details
Examples
Example 1: Compare Arrays
See Also

Syntax

rc=COMPAREARRAY(array1,array2);

rc
indicates whether the two arrays match.
0 arrays match
1 arrays do not match

Type: Numeric

array1
is one of the two arrays to be compared.

Type: Array

array2
is one of the two arrays to be compared.

Type: Array


Details

The COMPAREARRAY function allows you to compare two arrays for size and data equality. To be considered equal, the arrays must:


Examples

Example 1: Compare Arrays

The example compare several different arrays.

DCL num n1(5) n2(5,5) n3(*) n4(5) n5(*,*);
DCL char c1(5);
DCL num rc;

rc = comparearray(n1,n2); put rc=;
rc = comparearray(n1,c1); put rc=;
rc = comparearray(n1,n3); put rc=;
rc = makearray(n3,3);
rc = comparearray(n1,n3); put rc=;
rc = redim(n3,5);
rc = comparearray(n1,n3); put rc=;
do i=1 to 5;
   n1[i] = i;
   n4[i] = i;
end;

rc = comparearray(n1,n4); put rc=;
rc = copyarray(n2,n5);
rc = comparearray(n2,n5); put rc=;
rc = delarray (n3); rc delarray (n5);

The output for this code would be:

rc=1
rc=1
rc=1
rc=1
rc=0
rc=0
rc=0

See Also

COPYARRAY

DELARRAY

MAKEARRAY

SCL Arrays


Chapter Contents

Previous

Next

Top of Page

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