Command Reference : Function Reference : Function Reference: W
  
 
@wfind
Find location of word (case-sensitive) in string list.
Syntax: @wfind(str_list, str_cmp)
str_list: string
str_cmp: string
Return: integer
Looks for the 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 parts of words, use @instr.
Examples
@wfind("I did it", "did")
returns the number 2, indicating the string “did” is second in the list.
@wfind("I did not do it", "i")
This function is case-sensitive and searches for the full string, so “i” will not be found and the function will return the number 0.
If ALPHA1 is an alpha series,
series stfind = @wfind(alpha1, "did")
returns the position of the string word “did” in the string list values of ALPHA1 for each observation in the workfile sample.
If SVEC1 is an string vector,
vector stfind = @wfind(svec1, "I")
returns the position of the string word “I” in the string lists in each element of SVEC1.
Cross-references
See also @instr, @wfindnc, @wrfind, and @wrfindnc.