x******e 发帖数: 42 | 1 現有500 excel files and these file names are stored in another file called
file.dat.
How to quickly import these files (500 excel files) and stored as SAS files
respectly after transposing them?
I wrote the code for a single file, but have to run the macro 500 times with
different numbers. It will be tedious.......... Any other convenient way
by taking advantage of the file.dat?
3xs!!!
%macro dataread(number);
PROC IMPORT OUT= file&number
DATAFILE= "C\chart_data\CR&number..xls"
DBMS |
P****D 发帖数: 11146 | 2 http://www.nesug.org/proceedings/nesug08/cc/cc16.pdf
这个可以做到在一个文件夹下面见excel文件(或其他你规定的extention name)就处
理。
http://www2.sas.com/proceedings/sugi27/p105-27.pdf
这个可以列出一个文件夹下面的所有文件的文件名(当然还有文件最后修改时间之类的
其他参数,不过对你没用)。
我觉得随便哪一个都差不多能解决你的问题了。 |
t**s 发帖数: 156 | 3 Did you try "call execute"? |
s*********e 发帖数: 1051 | 4 copied from my blog:
*************************************************
* READ ALL EXCEL FILES WITH SAME STRUCTURE *
* FROM A FOLDER INTO SAS USING MACRO *
* DATE: SEP-29, 2005 *
*************************************************;
%macro ReadXls(dir = , out = );
*************************************************
* MACRO PARAMETERS: *
* DIR: FOLDER WHERE DATA IS STORED *
* OUT: NAME OF OUTPUT DATA TABLE *
*************************************************;
/* DELETE TABLE WITH SAME NAME AS OUTPUT DAT |