Hi,
From SAS documentation,
The TRANWRD function replaces all occurrences of a given substring within a character string. The TRANWRD function does not remove trailing blanks in the target string and the replacement string.
TRANWRD uses a single blank instead when the replacement string has a length of zero.
Try using compress to remove all the blank spaces,if you want.
data _null_;
string1='*' || compress(tranwrd('abcxabc', 'abc', trimn(''))) || '*';
put string1=;
string2='*' || compress('abcxabc', 'abc', '') || '*';
put string2=;
run;
Thanks,
Shiva