I do not understand your syntax but renaming can be done with this simple macro:
%do i=1 %to #
Although a proc datasets solution might be more efficient, the rename statement from your original code is valid. There are two problems with the code you posted. Since you are creating a new dataset instead of modifying an existing dataset in place, you need to use a set statement instead of a modify statement. Also, the end statement is not needed.