You may need to tweak the name pattern that you are looking for, or the processing for each file. But the concept is very much what you are asking for.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.