Assume that you would like it to be done in a macro environment. Here is a function like macro.
%let a=x y;
%let b=1 2;
%macro expmvar(a, b);
%let i=1;
%do %until(%scan(&a,&i)=%str( ));
%let j=1;
%do %until(%scan(&b,&j)=%str( ));
%scan(&a,&i)%scan(&b,&j)
%let j=%eval(&j+1);
%end;
%let i=%eval(&i+1);
%end;
%mend;
%let newvar=%expmvar(&a, &b);
%put >>>&newvar ...