SAS中文论坛

标题: 我出一题,请各位大虾来提供解决方案 [打印本页]

作者: shiyiming    时间: 2004-9-2 13:32
标题: 我出一题,请各位大虾来提供解决方案
data :
p1  2 4
p2 3  8
p1  2 4
p3  8  9
....


数据中有重复的纪录,用一种简单的方法把重复的纪录去掉(以第一个变量为key variable)
作者: shiyiming    时间: 2004-9-3 23:49
标题: reply
data a;
input a $ b c;
datalines;
p1 2 4
p2 3 8
p1 2 4
p3 8 9
;
run;
solution 1:
proc sort data=a out=b nodupkey;
by a b c;
run;
solution 2:
proc sort data=a out=c;
by a b c;
run;
data c;
  set c;
  by a b c;
  if not first.a and not first.b and not first.c then delete;
run;
作者: shiyiming    时间: 2004-9-6 09:46
标题: 谢谢forestshen
谢谢forestshen,我后来用的是solution 1;你的solution 2也启发了我的思路,非常感谢!




欢迎光临 SAS中文论坛 (http://mysas.net/forum/) Powered by Discuz! X3.2