how dynamic is the list of character variables?
Possibly could use the modifiers which provide more support for delimters.
CATQ() and COUNTW(), as shown in this SASlog snippet :[pre]1625 %let dynamic_var_list = c a b ;
1626 data ;
1627 a='1'; b='|'; c=' ' ;
1628 d= catq( 'mdt','|', of a c b );
1629 put d= ;
1630 e= countw( d, '|', 'mq' ) ;
1631 f= countw( d, '|', 'q' ) ;
1632 put e= f= ;
1633 allasone= countW( catq( 'mdt','|', of &dynamic_var_list ), '|', 'q' ) ;
1634 put (_all_)(=) ;
1635 run;
d=1||"|"
e=3 f=2
a=1 b=| c= d=1||"|" e=3 f=2 allasone=2
NOTE: