|
|
5#

楼主 |
发表于 2009-7-3 14:02:16
|
只看该作者
Re: 请教:相同的code, 不同的结果(关于monotonic()函数)
对,用两个PROC SQL就没有问题了。
只是对monotonic()的处理过程还是不懂。请看下面的code:
data a;
input x y;
cards;
3 1
4 2
5 5
6 8
;
run;
proc sql;
create table b as
select x, monotonic() as n
from a;
create table c as
select x,y, monotonic() as n
from a;
quit;
=====================================
table b:
x n
--------
3 1
4 2
5 3
6 4
table c:
x y n
-------------
3 1 1
4 2 2
5 5 3
6 8 4
======================================
proc sql;
create table d as
select mean(x) as meanx
from a
where monotonic() gt 2;
create table e as
select mean(x)as meanx,mean(y) as meany
from a
where monotonic() gt 2;
quit;
====================================
table d:
meanx
--------
5.5
table e:
meanx meany
---------------------
5.5 6.5
============================================= |
|