Command Reference : Function Reference : Function Reference: W
  
 
@wrfind
Find location of a word (case-sensitive) in a string list searching from end.
Syntax: @wrfind(str_list, str_cmp)
str_list: string
str_cmp: string
Return: integer
Looks for the last occurrence of string str_cmp in the string list str_list, and returns the position in the list or 0 if the string is not in the list.
This function is case-sensitive; use the @wfindnc function to ignore case.
Note that this function works only on single words; for multiple or partial words, use @instr.
Examples
= @wrfind("I did it. Did you?", "Did")
returns the number 4, indicating the string “Did” is 4th in the list.
= @wrfind("I did not do it", "i")
This function is case-sensitive and searches for the full word string, so “i” will not be found and the function will return the number 0.
If ALPHA1 is an alpha series,
series stfind = @wrfind(alpha1, "did")
returns the last position of the string word “did” matching words in the string list values of ALPHA1 for each observation in the workfile sample.
If SVEC1 is an string vector,
vector stfind = @wrfind(svec1, "I")
returns the last position of the string word “I” matching words in the string lists in each element of SVEC1.
Cross-references
See also @rinstr, @wrfindnc, @wfind, and @wfindnc.