|
INDEX FIRST MATCHName:
You can also return the index of the first or last row where the two arrays have different values. If all rows have the same value, then an index of 0 is returned. The two arrays do not need to be same size. For the case where the two arrays are of different sizes and we are looking for the first row where they do not have the same value, the index returned is MIN(N1,N2) + 1 where N1 and N2 are number of rows for the two arrays. For the case where the two arrays are of different sizes and we are looking for the last row where they do not have the same value, the index returned is MAX(N1,N2) where N1 and N2 are number of rows for the two arrays.
<SUBSET/EXCEPT/FOR qualification> where <y1> is the first response variable; <y2> is the second response variable; <par> is a parameter containing the returned index; and where the <SUBSET/EXCEPT/FOR qualification> is optional. This is for the case where we are looking for the index where the two arrays first have the same value.
<SUBSET/EXCEPT/FOR qualification> where <y1> is the first response variable; <y2> is the second response variable; <par> is a parameter containing the returned index; and where the <SUBSET/EXCEPT/FOR qualification> is optional. This is for the case where we are looking for the index where the two arrays last have the same value.
<SUBSET/EXCEPT/FOR qualification> where <y1> is the first response variable; <y2> is the second response variable; <par> is a parameter containing the returned index; and where the <SUBSET/EXCEPT/FOR qualification> is optional. This is for the case where we are looking for the index where the two arrays first have different values.
<SUBSET/EXCEPT/FOR qualification> where <y1> is the first response variable; <y2> is the second response variable; <par> is a parameter containing the returned index; and where the <SUBSET/EXCEPT/FOR qualification> is optional. This is for the case where we are looking for the index where the two arrays last have different values.
LET A = INDEX FIRST MATCH Y1 Y2 SUBSET TAG > 1 LET A = INDEX LAST MATCH Y1 Y2
read y1 y2
23 19
31 31
18 42
22 10
26 26
11 14
end of data
.
let n = size y1
let indx = sequence 1 1 n
set write decimals 0
.
let a1 = index first match y1 y2
let a2 = index last match y1 y2
let a3 = index first not match y1 y2
let a4 = index last not match y1 y2
.
set write decimals 0
print indx y1 y2
print a1 a2 a3 a4
The following output is generated.
---------------------------------------------
INDX Y1 Y2
---------------------------------------------
1 23 19
2 31 31
3 18 42
4 22 10
5 26 26
6 11 14
PARAMETERS AND CONSTANTS--
A1 -- 2
A2 -- 5
A3 -- 1
A4 -- 6
|
Privacy
Policy/Security Notice
NIST is an agency of the U.S.
Commerce Department.
Date created: 12/06/2011 | ||||||||