Some corrections:
The word "manual" is part of "manualentry" and "cedemanual", so if "manual" is removed first, "cede" and "entry" would stay in the string.
Using "_all_" in the array statement is not what you want, as it includes "policy_number" also.
Upcase and removing blanks and underscores was moved before the loop.
Using "policy_number" in the loops restores already removed words.
Changed from tranwrd to transtrn (see docs) and added trim to get rid of trailing blanks.
data want;
set test_set;
length new_policy_string $ 100;
array words[4] $ 15 _temporary_ ('MANUALENTRY', 'CEDEDMANUAL', 'MANUALCEDED', 'MANUAL');
new_policy_number = compress(transtrn(upcase(policy_number), '_', ''));
do i = 1 to dim(words);
new_policy_number = transtrn(new_policy_number, trim(words[i]), '');
end;
drop i;
run;
... View more