Hi @awmeyertimmy
You can try the following code to retrieve the number of the file in the macrovariable &num_file
eg. &num_file will take the value 123456 in your example, if 123456 is the maximum value among several numbers.
NB: this code assumes the number does not exceed 8 digits.
proc sql noprint;
select max(input(prxchange('s/^.+_//',1,trim(memname)),8.))
into: num_file trimmed
from dictionary.tables
where libname = "WORK" and prxmatch('/_\d+$/',trim(memname));
quit;
proc sql;
select memname
from dictionary.tables
where libname = "WORK" and scan(trim(memname),2,"_")="&num_file";
quit;
NB: please adapt your libname in the WHERE clause.
... View more