I already showed you how to generate the split files with numeric suffixes using a different method.
If you want to rename the existing files then first get the list of files into data. Say you have the list in a dataset named FILES and the filename is in a variable named FILENAME. Then you could use code like this to generate NEW_NAME variable.
proc sql;
create table rename_files
select substr(filename,1,length(filename)-6) as basename
, count(*) as n_files
, filename
group by 1
having count(*) > 1
;
quit;
data rename_files;
do suffix=1 by 1 until(last.basename);
set rename_files;
by basename;
new_name = cats(basename,putn(suffix,cats(Z,length(cats(n_files)),'.'),'.csv');
output;
end;
run;
You could then use that list to generate code to move, rename or copy the files.
... View more