Hi All, I have a macro which takes a list of variables say var1, var2, var3, var4, var5 and var6 as a parameter as shown the code below . In need to create a new variable say varlist containing these input variables separated by commas, without any quotation marks. I have tried it as follows, but it is not working :
%macro(vars= var1 var2 var3 var4 var5 var6);
%let varcount = %sysfunc(countw(&vars));
%let varlist=;
%do i = 1 %to &varcount;
%let varname = %qscan(&vars,&i);
%let var&i = &varname;
%let varlist = %unquote(%sysfunc(catx(',', &varlist, &&var&i)));
%put var list is &varlist;
%mend;
In the following NOTE is there in the log:
NOTE: Line generated by the macro variable "VARLIST"
1 var1','var2','var3','var4','var5','var6
Please, advise how achieve the result as var1,var2,var3,var4,var5,var6
Thanks
... View more