Drop words from string list.
Syntax: (str_list, pat_list)
str_list: string
pat_list: string
Return: string
Returns a string list, dropping elements in str_list that match the string pattern pat_list. The pat_list is space delimited and may be made up of any number of “?” (indicates any single character) or “*” (indicates any number of characters).
The pattern is case-sensitive and must exactly match the str_list characters to be dropped.
Examples
@wdrop("D D A B C", "B D C")
removes each instant of the elements “B”, “D”, and “C”, returning the string “A”.
@wdrop("ABC DEF GHI JKL", "?B? D?? *I")
drops the first three elements of the string list, returning the string “JKL”. The string pattern “?B?” drops “ABC”, the pattern “D??” drops “DEF”, and the pattern “*I” drops “GHI”.
If ALPHA1 is an alpha series,
alpha strdrop = @wdrop(alpha1, "B D C")
returns the string values of ALPHA1 after dropping “B D C” for each observation in the workfile sample.
If SVEC1 is an string vector,
svector strdrop = @wdrop(svec1, "*I")
returns an svector after dropping all elements that end in “I” from each element of SVEC1.
Cross-references