For instance, I have 2 macro variables ....
%let A = ('a','b','c');
%let B = ('d','e','f');
I'm trying to create a new macro variable from above 2 macro variables..
%let c = ('a','b','c','d','e','f');
I tried %let c = (&A,&B);
Use the compress() function within a %SYSFUNC to remove the parentheses from A and B...
You need to use %( and %) to represent the parentheses and prevent them from being interpreted as the closure of the %SYSFUNC.
%LET A = ('a','b','c') ; %LET B = ('d','e','f') ; %LET A2 = %SYSFUNC(compress(&A,%(%))) ; %LET B2 = %SYSFUNC(compress(&B,%(%))) ; %LET C = (&A2,&B2) ; /* or all in one... */ %LET C = (%SYSFUNC(compress(&A,%(%))),%SYSFUNC(compress(&B,%(%)))) ; %PUT &C ; Macro variable C resolves to ('a','b','c','d','e','f')
Incidentally, if you intend on using &C in an in() condition, it will work as-is, i.e.
%LET A = ('a','b','c') ; %LET B = ('d','e','f') ; %LET C = (&A,&B) ; data test ; letter = 'd' ; exist = letter in &C ; /* resolves to (('a','b','c'),('d','e','f')) */ run ;