Chapter Contents |
Previous |
Next |
COMPAREARRAY |
Category: | Array |
Syntax | |
Details | |
Examples | |
Example 1: Compare Arrays | |
See Also |
Syntax |
rc=COMPAREARRAY(array1,array2); |
0 | arrays match |
1 | arrays do not match |
Type: Numeric
Type: Array
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 |
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 |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.