meishanjia1900 发表于 2011-11-17 20:44 
由我再重复一遍,你的程序我运行了,出现明显错误。
连结果都无法产生。出错信息倒有一大堆。
Generating Repetitive Pieces of Text Using %DO Loops
“Conditionally Generating SAS Code” on page 8 presents a %DO-%END group of
statements to conditionally execute several SAS statements. To generate repetitive
pieces of text, use an iterative %DO loop. For example, the following macro, NAMES,
uses an iterative %DO loop to create a series of names to be used in a DATA statement:
%macro names(name= ,number= );
%do n=1 %to &number;
&name&n
%end;
%mend names;
The macro NAMES creates a series of names by concatenating the value of the
parameter NAME and the value of the macro variable N. You supply the stopping value
for N as the value of the parameter NUMBER, as in the following DATA statement:
data %names(name=dsn,number=5);
Submitting this statement produces the following complete DATA statement:
data dsn1 dsn2 dsn3 dsn4 dsn5;