Your macro is inserted un-requested spaces.
For example this call has empty value for replace_dlm but it is still inserting a space between the terms.
160 %put %qmodify_list(1 2, add_prefix=%nrstr(&n));
&n1 &n2
It is doing that because you added a space after the comment in front on where you expanded TERM.
Use code like this instead.
%*;&term
If you want the default to have a space inserted then set that as the default value for the REPLACE_DLM parameter.
%macro qmodify_list(string,dlm_charlist=%str( ,),add_prefix=,add_suffix=,replace_dlm=%str( )) ;
... View more