I have a macro variable, named 'Num_period', which was used to create new columns. %global Num_period;
%let Num_period=23; Now, names for those new columns have a pattern like: Period_1_Sum, Period_2_Sum, ... , Period_23_Sum. Now we would like to use a loop, and a rename function in data step to rename all columns to: 0, 1, 2 ... 22; The codes I expect would be something like: data test;
set train;
do i = 1 to &Num_period;
rename Period_{i}_Sum {i}-1;
end;
run; The codes provided above aren't correct obviously. Could you provide the correct way of doing it? Thanks.
... View more