oliyiyi
我的sas数据表如下(已按a排序):
obs a b 。。。
1 0.21 0.22 。。。
2 0.21 0.123 。。。
3 0.32 0.234 。。。
4 0.32 0.234 。。。
5 0.32 0.237 。。。
6 0.32 0.345 。。。
7 0.43 0.654 。。。
。。。。。。。。。。。。。。。
我的目的:把数据表中a列中相邻重复观测数小于4的行都删除(例如上面的1行和2行只有两次重复,故需要删除,整个表有6万多条数据,其中a列已按升序排列)
该如何编程?请大家指教!(试了first和last方法,都没有想到方法解决)
oliyiyi
用了sql,已经搞定了!
kuhasu
easy
rtist
[quote]引用第1楼oliyiyi于2007-09-16 04:52发表的“”:
用了sql,已经搞定了![/quote]
congratulations
oliyiyi
[quote]引用第2楼kuhasu于2007-09-16 20:46发表的“”:
easy [/quote]
能告诉我你easy的办法吗?
罗罗
data a;
set a;
if a<4 then delete;
run;
看看这个程序中不中。
oliyiyi
[quote]引用第5楼罗罗于2007-09-30 23:00发表的“”:
data a;
set a;
if a<4 then delete;
run;
看看这个程序中不中。[/quote]
当然不行了,你没有看清除题目,是重复的个数小于4,不是变量的取值小于4!
waterlwh
用sql是最直接的了,除此此外可以尝试以下的程序:
proc freq data=a noprint;
table a/out=b(where=(count>=4));
data ab(drop=count percent);
merge a(in=a1) b(in=b1);
by a;
if a1 and b1;
run;