Command Reference : Function Reference : Function Reference: W
  
 
@wcross
String with words in first list crossed with second.
Syntax: @wcross(str_list1, str_list2[, pattern])
str_list1: string
str_list2: string
pattern: string
Return: string list
Returns str_list1 crossed with str_list2, using the string pattern. The default pattern is “??”, which indicates that each element of str_list1 should be crossed individually with each element of str_list2.
Examples
@wcross("A B C", "1 2 3 4")
returns every combination of the elements “A B C” and “1 2 3 4”, using the default pattern “??”. This produces the string list: “A1 A2 A3 A4 B1 B2 B3 B4 C1 C2 C3 C4”.
@wcross("ABC DEF", "1 2 3", "?-?")
returns the string list “ABC-1 ABC-2 ABC-3 DEF-1 DEF-2 DEF-3”, inserting a dash (“-”) between each crossed element as the “?-?” pattern indicates.
If ALPHA1 is an alpha series,
alpha alphacx = @wcross(alpha1, "1 2 3 4")
crosses the string lists in ALPHA1 with “1 2 3 4” for each observation in the workfile sample.
If SVEC1 and SVEC2 are string vectors,
svector sveccx = @wcross(svec1, svec2)
crosses the string list in SVEC1 with the corresponding string list in SVEC2 for each element of the two svectors.
Cross-references
See also @winterleave, @wintersect, and @wunion.