since you want a common suffix, depending on the source data set, I don't understand why having many names causes the rename restriction, nor the suggestion of using an array. The "data dictionary" tables in a SAS environment, allow the names to be treated as data and stored for use in a macro variable, like[pre]
proc contents data= your.dataset1 noprint out= names1; run;
proc contents data= your.dataset2 noprint out= names2; run;
proc sql ;
select trim( name) !! '=' !! trim( name) !! '_1'
into :rename1 separated by ' '
from names1
where lowcase(name) ne "key_column_name"
;
select trim( name) !! '=' !! trim( name) !! '_2'
into :rename2 separated by ' '
from names2
where lowcase(name) ne "key_column_name"
;
quit;[/pre]
That prepares the rename information without you having to name any columns, except logical exclusions from renaming, like the key fields.
Use this rename information in your merge step, like[pre]
data merged_data ;
merge your.dataset1( rename= (&rename1))
your.dataset2( rename= (&rename2)) ;
by key_column_name ;
run;
[/pre]
So, is there some real reason to use arrays and avoid the rename processing ?
PeterC