This my macro cust. I need to pass multiple values for the macro variable state.
If I am calling a macro like this
%cust(dsn = Profile1, vars = Acct_ID Name Age Balance State, age_range= "18-40",  state = "NY");
It is working fine.
 
But if I pass multiple values in state. It is throwing an error. How to resolve this. Example below.
%cust(dsn = Profile1, vars = Acct_ID Name Age Balance State, age_range= "18-40",  state = "NY", "CA");
 
%macro cust(dsn = , vars = , age_range= , state=);
  %if &state = "NY" %then
  %do;
    proc print data = &dsn;
    var &vars;
    where State = &state and Age_Range = &age_range;
    title "Detail Listing of Account in &state and current date &sysdate";
    run;
   
    title "Total Balance in &state and in age &age_range current date &sysdate";
    proc sql;
    select %sysfunc(tranwrd(%sysfunc(compbl(&vars)),%str( ),%str(,))), sum(Balance) as Total_Balance
    from &dsn
    where State = &state and Age_Range = &age_range;
    quit;
   
 %end;
 
 %else %if &state = "CA" %then
 %do;
    proc print data = &dsn;
    var &vars;
    where State = &state and Age_Range = &age_range;
    title "Detail Listing of Account in &state and current date &sysdate";
    run;
   
    title "Total Balance in &state and in age &age_range current date &sysdate";
    proc sql;
    select %sysfunc(tranwrd(%sysfunc(compbl(&vars)),%str( ),%str(,))), sum(Balance) as Total_Balance
    from &dsn
    where State = &state and Age_Range = &age_range;
    quit;
   
 %end;
 
 %else %if &state = "WA" %then
 %do;
   proc print data = &dsn;
    var &vars;
    where State = &state and Age_Range = &age_range;
    title "Detail Listing of Account in &state and current date &sysdate";
    run;
   
    title "Total_Balance in &state and in age &age_range current date &sysdate";
    proc sql;
    select %sysfunc(tranwrd(%sysfunc(compbl(&vars)),%str( ),%str(,))), sum(Balance) as Total_Balance
    from &dsn
    where State = &state and Age_Range = &age_range;
    quit;
   
 %end;
 
%mend cust;
 
Thanks.