RUNS inputVector test resultVariable

A run in a vector is a series of consecutive elements all with the same value. The length of a run is the number of elements in the run. The RUNS command replaces the contents of the result variable with the number of runs whose lengths satisfy the test.

A run length of 1 is allowed.

"Missing" data (NaN or ".") are ignored in computing runs.

COPY (1 1 2 2 2 4 3 8 8 7) A
RUNS A =2 B
RUNS A >=2 C
RUNS A =3 D
RUNS A =1 E
PRINT A B C D E

The above program produced the following result:

A: (1.0 1.0 2.0 2.0 2.0 4.0 3.0 8.0 8.0 7.0)
B: 2.0
C: 3.0
D: 1.0
E: 3.0