something like
%let males =%sysfunc( tranwrd(%superq(males),%str(,,), %str(,) ));
with superQ to protect the commas in the value of &males, from being treated as syntax, rather than data
Another issue to manage: occasions where more than two commas occur.
Here is a small demo
%let males = a,b,,c,,,d,,,,e,,,,,,f,,,,,,,g,,,,,,,,h;
%let males =%sysfunc( tranwrd(%superq(males),%str(,,), %str(,) ));%put &males ;
%let males =%sysfunc( tranwrd(%superq(males),%str(,,), %str(,) ));%put &males ;
%let males =%sysfunc( tranwrd(%superq(males),%str(,,), %str(,) ));%put &males ;
[pre]1 %let males = a,b,,c,,,d,,,,e,,,,,,f,,,,,,,g,,,,,,,,h;
2 %let males =%sysfunc( tranwrd(%superq(males),%str(,,), %str(,) ));%put &males ;
a,b,c,,d,,e,,,f,,,,g,,,,h
3 %let males =%sysfunc( tranwrd(%superq(males),%str(,,), %str(,) ));%put &males ;
a,b,c,d,e,,f,,g,,h
4 %let males =%sysfunc( tranwrd(%superq(males),%str(,,), %str(,) ));%put &males ;
a,b,c,d,e,f,g,h[/pre]
looks like it needs three compbl() invocations to deal with all.