I have one dataset including two(x y) or more variables. I want to do some transformation (for examle, power transformation) on my data and get a new dataset including x, y, trans_x and trans_y. Because I probably have more than two variables in my dataset, I wrote one macro. %macro data_trans(inputdata, outputdata, varlist, trans_factor); data &outputdata; set &inputdata; num=countw("&varlist"); do i=1 to num; 'tran_'||left(scan(&varlist,i))= (scan(&varlist,i))**&trans_factor; /* create one new variable name and do data transformation*/ end; drop num i; run; %mend; or %macro data_trans(inputdata, outputdata, varlist, trans_factor); data &outputdata; set &inputdata; array arr &varlist; do over arr; 'trans_'||arr=arr**&trans_factor; /* create one new variable name and do data transformation*/ end; run; %mend; Either of them didn't work. Something wrong was with "||". Anyone could help me out with it? Greatly appreciated.
... View more