So if you are setting the macro variable VARS to a space delimited list of variable names.
%cust(dsn=datasetname,vars=Acct_ID Age Balance State,age_range="18-40",state="NY");
Then that will work well for the VAR statement of PROC PRINT.
var Acct_ID Age Balance State;
But not work well for the columns list in a PROC SQL SELECT statement. For SQL you want commas instead of spaces between the variable names. Like :
... select Acct_ID,Age,Balance,State ...
It is easy to convert using %SYSFUNC() to call the TRANWRD() (or TRANSLATE()) function.
select %sysfunc(tranwrd(&vars,%str( ),%str(,)))
Just make sure that there is one and only one space between the variable names. Which you can do with the COMPBL() function.
select %sysfunc(tranwrd(%sysfunc(compbl(&vars)),%str( ),%str(,)))