SUBTRACT inputVector inputVector {inputVector} resultVariable

Subtracts from each element of the first input vector the corresponding element of all the other input vectors and copies the difference into the corresponding element of the result vector.

If the input vectors are of different lengths, the shorter vectors will be "extended" to the length of the longest by repeating their last element as many times as necessary. This extension is only done internally and does not change the actual size or content of the shorter vectors.

If any element is a "missing" value (represented by a "." Or "NaN") the result for that position will also be missing.

COPY -5,5 NaN vec1
COPY 1,5 vec2
SUBTRACT vec1 vec2 answer
PRINT vec1 vec2 answer

The above program produces the following output:

vec1: (-5.0 -4.0 -3.0 -2.0 -1.0 0.0 1.0 2.0 3.0 4.0 5.0 NaN)
vec2: (1.0 2.0 3.0 4.0 5.0)
answer: (-6.0 -6.0 -6.0 -6.0 -6.0 -5.0 -4.0 -3.0 -2.0 -1.0 0.0 NaN)

Note that the size of vec2 is unchanged.