Checks one string array against another and returns the indices of the first string array in the second string array.
needle (Nx1 string array) – contains the values to be found in vector haystack
haystack (Mx1 string array) – searched for the corresponding elements of needle
indx (Nx1 vector of indices) – the values of needle in haystack.
// What elements to look for needle = "Maggie" $| "Bart" $| "Lisa"; // Vector to look in haystack = "Homer" $| "Moe" $| "Bart" $| "Sideshow" $| "Lisa" $| "Milhouse" $| "Maggie"; // Find locations of needle in haystack z = indsav(needle, haystack);
7.0000000 z = 3.0000000 5.0000000
If no matches are found, those elements in the returned vector are set to the GAUSS missing value code.
If there are duplicate elements in haystack, the index of the first match will be returned.