Command Reference : Function Reference : Function Reference: W
  
 
@winterleave
Interleave words of two string lists.
Syntax: @winterleave(str_list1, str_list2[, n1, n2])
str_list1: string
str_list2: string
n1: (optional) integer
n2: (optional) integer
Return: string
Interleaves str_list1 with str_list2, according to the pattern specified by n1 and n2. The default uses counts of one.
Examples
@winterleave("A B C", "1 2 3")
interleaves “A B C” with “1 2 3” to produce the string list “A 1 B 2 C 3”.
@winterleave("A B C", "1 2 3 4 5 6")
interleaves “A B C” with “1 2 3 4 5 6”, returning the string list “A 1 B 2 C 3 “” 4”. Since there are more elements in the second string, empty strings (“”) are inserted when the elements of the first string run out.
Alternately, you may specify a count pattern to control the spacing of elements:
@winterleave("A B C", "1 2 3 4 5 6", 1, 2)
This command combines one element of the first string for every two elements of the second string, returning “A 1 2 B 3 4 C 5 6”.
If ALPHA1 is an alpha series,
alpha alphacx = @winterleave(alpha1, "1 2 3 4")
interleaves 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 sveclen = @winterleave(svec1, svec2, 1, 2)
interleaves the string list in SVEC1 with the corresponding string list in SVEC2 for each element of the two svectors, using one element of the SVEC2 strings for every two elements of the SVEC2 strings.
Cross-references
See also @wcross, @wintersect, and @wunion.