In the buffer variable, you have the whole path name of the files you searched for. You now have to extract the directory path (everything up to the last \), which you later use to assign a libname to, so you can use that libname as the source lib in the proc datasets procedure. You also extract the filename itself, strip the .sas7bdat and get the logical SAS member name of the dataset. This is what you use in the select statement of proc datasets. What it amounts to is a lot of call execute or macro processing. Or you do it with the help of the operating system. In UNIX it would look like that: find $PATH -type f -name \*.sas7bdat -exec cp {} $TARGET \; I'd assume that windows has a usable equivalent of the find command by now.
... View more