楼主: 小鳄鱼a
1901 11

求助个问题 [推广有奖]

11
小鳄鱼a 发表于 2015-12-16 13:50:35
pobel 发表于 2015-12-15 08:49
如果数据量不太大,试试这个:
proc sql;
   create table wanted as
不好意思   excel文字说明有问题     本意是同一com中间如果间隔了其他  com   ,如
1998/6/1        王五        金华
1998/7/1        王五        金华
1998/9/1        王五        凤阳
1999/9/9        王五        凤阳
1999/11/1        王五        金华
1998/12/1        王五        金华
那么   考察的时间段是  1998/7/1 到  1999/11/1 的天数

12
wodewin 发表于 2015-12-17 16:26:39
data dst;
  set a;*a是假定的原始数据集*
  year=scan(date,1,"-");
  month=scan(date,1,"-");
run;
proc sort data=dst;
  by name com year month;
run;

data dst1;
  set dst;
  by name com year;
  if last.year then output;
run;

如果数据量庞大的话,这种方法太过费时。
已有 1 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
小鳄鱼a + 5 + 5 + 5 + 5 精彩帖子

总评分: 论坛币 + 5  学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-29 06:46