jingju11 发表于 2012-12-17 10:30 
为什么不给出代码和结果?有些空谈。我的结论是因为sas/iml需要读入数据,计算,然后输出。数据步三者合一。 ...
嗯,不好意思,之前没有给出结果因为是前两天随便试的
我当时就是想了解下用Data步和IMl的效率差别
刚才我用更大的样本比较了下,确实用data步要快多了,贴下结果
方法一:iml
NOTE: Exiting IML.
NOTE: The data set WORK.HAVE1 has 4469063 observations and 3 variables.
NOTE: 10383 workspace compresses.
NOTE: PROCEDURE IML used (Total process time):
real time 27.32 seconds
cpu time 19.10 seconds
方法二:data步中使用array
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
3 at 572:18
NOTE: There were 4469063 observations read from the data set WORK.HAVE.
NOTE: The data set WORK.HAVE2 has 4469063 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 7.31 seconds
cpu time 2.56 seconds