LZ可以尝试如下方法:
/********
In the Microsoft Windows? environment, this is done with the venerable “dir” command.
Actually, to avoid unneeded parsing, a wildcard (‘*’) and the ‘/b’ (‘bare’) switch
are used to reduce the list to just what is needed. Here is the new version:
********/
%let my_dir = E:\MySasData\ ;
%let dat = sas7bdat ;
filename dir_list pipe "dir &my_dir.*.&dat /b" ;
data file_list ;
length fname $40. ;
infile dir_list truncover ;
input fname $40. ;
call symput( 'num_files',_n_ ) ;
run ;
具体可以搜索看看filename的PIPE选项如何使用。