Hi Rick, I came accross your answer since I am confronted with a similar issue. I can easily transscript this to alphanumerical as well as having column 2 of matrix two containing the values I like to know. proc iml; one = {a, c, e, h}; two = {a aa, b bb, c cc, d dd, e ee, f ff, g gg, h hh}; idx = loc (element(two, one)); v = two(idx); do i = 1 to ncol(idx); n = idx; newmat = two[loc(one=v),2]; end; print newmat; quit; However, my real word looks different: - 'one' contains strings, e.g.: one = {hat, cap, bottle, bottleholder}; - 'two' contains even longer strings and multiple matches, e.g.: two = {'mouse with glasses' '223 567', 'house with bottleholder in black' '345 987', 'baseballcap in blue' '678 912', 'pink baseballcap' 345 123', 'cap from plant material' '678 123' }; Now I would like to find in 'two' all the "number strings" connected to the "word strings" which match the strings in 'one', including "baseballcap ..." such that the result would look something like newmat_result = {'hat' '' '' '', 'cap' '678 912' '345 123' '678 123', bottle '' '' '', bottleholder '345 987' '' ''}; I worked with regular expressions before, but those were handwritten and not extracted from one matrix to match another matrix. After days of searching and trying, I hope that I find somebody with an idea to solve this issue. Thank you for any pointers! Regards from Germany Gerit PS: I made this reply into a post
... View more