Well it will work, but it will not do what you want.
You are using the LIBNAME statement, which is a global statement and will be executed once. The LIBNAME function, otoh, is executable and will be executed once for each observation on you incoming data.
There are other issues in your code in addition to the original question. If you are going to read the XLS file directly into the DATA step, you will need to use the EXCEL engine.
If I can guess at your larger task, it looks like a macro loop surrounding a series of PROC IMPORT steps might be closer. To be more helpful I need to know more about the full task.
... View more