全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
8179 7
2013-04-04
悬赏 2 个论坛币 已解决
现有数据集中有2个时间字段,都是精确到秒的,第一个是事件发生时间,第二个是结束事件,求中间间隔时间,结果显示为多少分多少秒。
具体数据集如下:
data aaaa;
input serv_id $ otherpart $ comm_type $ start_time datetime19.  end_time datetime19. ;
informat
serv_id $2.
otherpart $2.
comm_type $2.
start_time datetime19.
end_time   datetime19.;

format
serv_id $2.
otherpart $2.
comm_type $2.
start_time datetime19.
end_time   datetime19.;

cards;
a b 1 10NOV2012:03:40:19 10NOV2012:03:59:19
a c 1 10NOV2012:04:40:19 10NOV2012:05:15:19
a b 0 22NOV2012:16:22:11 22NOV2012:16:22:11                                
b a 1 02NOV2012:09:49:13 02NOV2012:09:59:19
c b 1 02NOV2012:13:00:19 02NOV2012:13:12:19
d l 0 26NOV2012:23:49:19 27NOV2012:01:59:19
;
run;


最佳答案

webgu 查看完整内容

data aaaa; input serv_id $ otherpart $ comm_type $ start_time datetime19. end_time datetime19. ; informat serv_id $2. otherpart $2. comm_type $2. start_time datetime19. end_time datetime19.; format serv_id $2. otherpart $2. comm_type $2. start_time datetime19. end_time datetime19.; diff= put(int((end_time-start_time)/60), best.) ||"Minutes"||","||put(mod(end_time-start_tim ...
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2013-4-4 21:00:23
data aaaa;
input serv_id $ otherpart $ comm_type $ start_time datetime19.  end_time datetime19. ;
informat
serv_id $2.
otherpart $2.
comm_type $2.
start_time datetime19.
end_time   datetime19.;

format
serv_id $2.
otherpart $2.
comm_type $2.
start_time datetime19.
end_time   datetime19.;

diff= put(int((end_time-start_time)/60), best.) ||"Minutes"||","||put(mod(end_time-start_time,60), best.)||"seconds";

cards;
a b 1 10NOV2012:03:40:19 10NOV2012:03:59:19
a c 1 10NOV2012:04:40:19 10NOV2012:05:15:19
a b 0 22NOV2012:16:22:11 22NOV2012:16:22:11                                
b a 1 02NOV2012:09:49:13 02NOV2012:09:59:19
c b 1 02NOV2012:13:00:19 02NOV2012:13:12:19
d l 0 26NOV2012:23:49:19 27NOV2012:01:59:19
;
run;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-4-4 21:07:16
楼主牛啊
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-4-4 21:09:25
复制代码

2013-04-04_211556.gif
2013-04-04_211556.gif
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-4-4 21:21:31
zhengbo8 发表于 2013-4-4 21:09
感谢你的帮助,有2个问题请教你
1.如果我要精确到 几分钟零几秒钟  要怎么改呢?
2.如何在回复时吧自己的代码设置成像你这样的。我希望在自己力所能及的时候也能帮别人。呵呵。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-4-4 21:26:56
lovelybetty1208 发表于 2013-4-4 21:21
感谢你的帮助,有2个问题请教你
1.如果我要精确到 几分钟零几秒钟  要怎么改呢?
2.如何在回复时吧自己 ...
2013-04-04_211556.gif

2013-04-04_212004.gif
注意红色部分!

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群