SAS中文论坛

标题: 求助:重复观测(相同id),如何保留第一位观测?? [打印本页]

作者: shiyiming    时间: 2010-9-19 00:25
标题: 求助:重复观测(相同id),如何保留第一位观测??
数据集如下,若id相同,则保留按照id排序后的第一个id,
[code:1wtvgh12]data repeatid;
input id x@@;
cards;
201   45
201   26
207   96.6
207   107.8
210   130.2
210   141.4
210   152.6
216   197.4
216   208.6
216   219.8
216   231
;[/code:1wtvgh12]
想得到如下的结果,先谢谢了
[code:1wtvgh12]data repeatid0000;
input id x@@;
cards;
201   45
207   96.6
210   130.2
216   197.4
;[/code:1wtvgh12]
作者: shiyiming    时间: 2010-9-19 09:18
标题: Re: 求助:重复观测(相同id),如何保留第一位观测??
[code:1dhjggh0]
data first;
set repeatid;
by id;
if first.id;
run;
[/code:1dhjggh0]




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