l***y 发帖数: 207 | 1 Hi, dear all,
Sorry, can't type Chinese right now.
I would like to find out the first date when the return is not 0. My
data are as follows.
ID date return
11 19980607 0
11 19980606 0
11 19980605 0
11 19980604 0
...... 0
11 19971231 0.1
11 19971230 0.15
22 19990507 0
22 19990506 0
22 19990505 0
22 19990504 0
...... 0
22 19990201 0.2
22 19990131 0.23
333 20101031 0.2
333 20101030 0.15
333 20101029 0.145
For each company (identified by ID), I would like to find the first
NON-ZERO return and the date. For example, for company 11 I would like
to find out 19971231, for company 22 I would like to find out
19990201, and for company 333 there is no data since it doesn't have
non-0 return. Could you please help me on it? Any suggestion will be
highly appreciated. Thanks.
Have a good day,
^_^ | o****o 发帖数: 8077 | 2 proc sql;
create view tempv as
select *
from yourdata(where=(return^=0))
order by id, date
;
quit;
data selected;
set tempv;
by id date;
if first.id;
run; | z**********i 发帖数: 12276 | 3 今天,这么得闲,回答一下我的问题吧. ;-)
http://www.mitbbs.com/article_t/Statistics/31288317.html
多谢!
【在 o****o 的大作中提到】 : proc sql; : create view tempv as : select * : from yourdata(where=(return^=0)) : order by id, date : ; : quit; : data selected; : set tempv; : by id date;
| o****o 发帖数: 8077 | 4 this is super easy one, your Q needs some work
I will get back to you once it is done
【在 z**********i 的大作中提到】 : 今天,这么得闲,回答一下我的问题吧. ;-) : http://www.mitbbs.com/article_t/Statistics/31288317.html : 多谢!
| z**********i 发帖数: 12276 | 5 多谢!呵呵.
【在 o****o 的大作中提到】 : this is super easy one, your Q needs some work : I will get back to you once it is done
| l***y 发帖数: 207 | 6 he he~~~ Many many thanks ^_^
I will use your code. : )
【在 o****o 的大作中提到】 : proc sql; : create view tempv as : select * : from yourdata(where=(return^=0)) : order by id, date : ; : quit; : data selected; : set tempv; : by id date;
|
|