由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - one SAS question regarding selecting specific year
相关主题
新人报道,兼问SAS data set的问题求助:SAS使用问题(读数据)
SAS code help请教SAS ODS to Excel
SAS code求教A SAS question
SAS 去除leading zero的问题[合集] 请教一个percentile的问题 (SAS)
请教一个SQL 的问题问一个简单的SAS问题,多谢
MySQL语句请教 (转载)[合集] 新手首次发贴 SAS 问题急问,谢谢大家的帮助
对应STATA的SAS CODE请教一个SAS数据input的问题
请教一个SAS文件循环生成的小问题SAS问题请教
相关话题的讨论汇总
话题: 22话题: 11话题: 333话题: sas话题: return
进入Statistics版参与讨论
1 (共1页)
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;

1 (共1页)
进入Statistics版参与讨论
相关主题
SAS问题请教请教一个SQL 的问题
问个简单的SAS如何找出某个变量最大之所在的行?MySQL语句请教 (转载)
问个SAS问题对应STATA的SAS CODE
数据结构如下,想用SAS调出有2年以上数据的ID请教一个SAS文件循环生成的小问题
新人报道,兼问SAS data set的问题求助:SAS使用问题(读数据)
SAS code help请教SAS ODS to Excel
SAS code求教A SAS question
SAS 去除leading zero的问题[合集] 请教一个percentile的问题 (SAS)
相关话题的讨论汇总
话题: 22话题: 11话题: 333话题: sas话题: return