Functions That Compare Strings (Exact and “Fuzzy” Comparisons)

Functions in this section enable you to compare strings that are exactly alike (similar except for case) or close (not exact matches). Programmers find this latter group of functions useful in matching names that may be spelled differently in separate files.

Function:   COMPARE

Purpose:    To compare two character strings. When used with one or more modifiers, this function can ignore case, remove leading blanks, truncate the longer string to the length of the shorter string, and strip quotation marks from SAS n-literals. While all of these tasks can be accomplished with a variety of SAS functions, use of the COMPARE function can simplify character comparisons.

Syntax:      COMPARE( ...

Get SAS Functions by Example, Second Edition, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.