SAS中文论坛

标题: 挑战SAS高手 [打印本页]

作者: shiyiming    时间: 2013-5-3 20:29
标题: 挑战SAS高手
数据集a部分如下:
datetime                     oppor
24dec12:09:30:02        0.003   
24dec12:09:30:05        0.002
24dec12:09:30:08        0.001
24dec12:09:30:24        -0.001
24dec12:09:30:32        0.001
24dec12:09:30:46        0.001
24dec12:09:30:54       0.002
问题是增加一列time:如果oppor与其一行滞后异号,则time=0,如果oppor与其一行滞后同号,则继续向下搜寻,直至滞后n+1行出现异号,time=滞后n行的datetime与当前行的datetime相差的时间。按照此规则,上述数据部分求出来的time应该为:6, 3, 0,0, 22,8,缺失值
作者: shiyiming    时间: 2013-5-3 21:22
标题: Re: 挑战SAS高手
目测,不难。家里装修,很乱没法用电脑!
作者: shiyiming    时间: 2013-5-6 18:01
标题: Re: 挑战SAS高手
直接采用一个双set操作就可以了。
作者: shiyiming    时间: 2013-5-15 05:35
标题: Re: 挑战SAS高手
'oppor与其一行滞后异号', what does this mean?   current value is different from the next value in sign?
also, how can you get 22,8,., you'd better explain them in details so that everyone can easily understand your question. i.e. what is the each start point and how to continue the process.
Sorry for my weakness in figuring out your real mean.




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