You didn't show how you are using the loop, not specify the size of the A and B vectors. In general, the operation you are requesting is of the order N*M where A has N elements and B has M elements because for each element of A you have to search through all elements of B.
If you can treat the vectors as sets in which order doesn't matter, you can use the LOC and ELEMENT functions to obtain the values in B that correspond to elements of A:
proc iml;
a = {104,106,101,104};
b = {101,102,103,104,105,106};
c = {"A", "B","C","D","E","F"};
idx = element(b, a);
ans = c[loc(idx)];
print ans; /* answer as a set; order does not matter */
However, if you want to preserve order and permit duplicate values, then the following loop is probably the method I'd use:
ans = j(nrow(a), 1, " ");
do i = 1 to nrow(a);
ans[i] = c[ loc(a[i] = b) ];
end;
print ans;
Another efficient approach would be to sort A and B (and C, sorted by B) and then do a match merge in Base SAS. That would probably be the fastest.