COMPARE Statement

The COMPARE statement enables the comparison of two strings.

Format

COMPARE String1 TO String2 {PRESENT sameones} {MISSING diffones}

Description

COMPARE allows the comparison of the contents of two variables to find the matches and mismatches. This statement works its way along the elements (components) of String1, seeing if they are present in String2. If the PRESENT option was specified, the variable associated with it contains all the elements that appear in both lists. If the MISSING option was specified, the associated variable contains all the elements which appear in String1 and not in String2.

Example

COMPARE String1 TO String2

{PRESENT string 3 | MISSING String}

See Also

Statement and Function Reference