v*******e 发帖数: 11604 | 1 问题1已经解决;底下还有问题2;
问题1, 比如一个data set, 这样的:
A B date
Li Wang 2011
Wang Li 2011
那么我对date排序,排出来顺序是怎样的?有规定吗?SAS9.2和9.3的结果有没有可能
是不同的?
问题2, 同样一个date set, 用proc sql来sort,
proc sql;
create table myresult
as select A, B, date
from mydataset
order by date;
;
quit;
排出来顺序是怎样的?有规定吗?SAS9.2和9.3的结果有没有可能是不同的? | p********a 发帖数: 5352 | | v*******e 发帖数: 11604 | 3 谢谢,看了documentation, 有这个option, default是EQUALS
EQUALS | NOEQUALS
specifies the order of the observations in the output data set. For
observations with identical BY-variable values, EQUALS maintains the
relative order of the observations within the input data set in the output
data set. NOEQUALS does not necessarily preserve this order in the output
data set.
Default: EQUALS | v*******e 发帖数: 11604 | 4 看了doc, 似乎用proc sql排序,首楼例子的结果是不定的。9.3的doc:
The order of the output rows that are returned is guaranteed only for
columns that are specified in the ORDER BY clause.
Note: The ORDER BY clause does not guarantee that the order of the rows
generated is deterministic. The ANSI standard for SQL allows the SQL
implementation to specify whether the ORDER BY clause is stable or unstable.
If the joint combination of values that is referenced in an ORDER BY clause
for a query are unique in all of the rows that are being ordered, then the
order of rows that is generated by ORDER BY is always deterministic. However
, if the ORDER BY clause does not reference a joint combination of unique
values, then the order of rows is not deterministic if ORDER BY is unstable. |
|