COMPLEV Function
Returns the Levenshtein edit distance between two strings.
| Category: | Character |
| Restrictions: | This function is assigned an I18N Level 0 status, and is designed for SBCS data. Do not use this function to process DBCS or MBCS data. For more information, see Internationalization Compatibility. |
| This function is not valid on the CAS server. |
Syntax
Required Arguments
string-1
specifies a character constant, variable, or expression.
string-2
specifies a character constant, variable, or expression.
Optional Arguments
cutoff
specifies a numeric constant, variable, or expression. If the actual Levenshtein edit distance is greater than the value of cutoff, the value that is returned is equal to the value of cutoff.
modifier
specifies a character string that can modify the action of the COMPLEV function. You can use one or more of the following characters as a valid modifier:
| i or I | ignores the case in string-1 and string-2. |
| l or L | removes leading blanks in string-1 and string-2 before comparing the values. |
| n or N | removes quotation marks from any argument that is an n-literal and ignores the case of string-1 and string-2. |
| : (colon) | truncates the longer of string-1 or string-2 to the length of the shorter string, or to one, whichever is greater. |
Details
-
"LN" first removes leading blanks from each string and then removes quotation marks from n-literals.
-
"NL" first removes quotation marks from n-literals and then removes leading blanks from each string.
COMPLEV(string-1,string-2) is the same
as COMPLEV(string-2,string-1).
Comparisons
Example
data test; infile datalines missover; input string1 $char8. string2 $char8. modifiers $char8.; result=complev(string1, string2, modifiers); datalines; 1234567812345678 abc abxc ac abc aXc abc aXbZc abc aXYZc abc WaXbYcZ abc XYZ abcdef aBc abc aBc AbC i abc abc abc abc l AxC 'abc'n AxC 'abc'n n ; proc print data=test; run;
