楼主: 百草园Tracy
2192 7

求助!SAS里面如果删除时间序列长度少于20的观测 [推广有奖]

  • 0关注
  • 0粉丝

硕士生

23%

还不是VIP/贵宾

-

威望
0
论坛币
119 个
通用积分
8.2495
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
2220 点
帖子
106
精华
0
在线时间
91 小时
注册时间
2007-5-18
最后登录
2015-4-12

楼主
百草园Tracy 发表于 2010-3-9 15:34:38 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
有很多个公司的数据,每个公司的时间序列长度不一样。
如果这个公司的时间序列长度小于20就删除这个公司的所有观测(也就不把这个公司作为样本)

研究了很多方法,都不行。

请教大牛!怎么操作呢?

谢谢了!
二维码

扫码加我 拉你入群

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

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

关键词:时间序列 怎么操作 求助 序列 SAS 观测 长度

回帖推荐

windlove 发表于6楼  查看完整内容

proc sort data=your_data; by companies; proc means data = your_data noprint; output out=after_deletion(drop = _type_ _freq_ where=(Num_of_price>=20) n(stock_series) =Num_of_prices; by your_companies; run; The data of "after_deletion" contains the company names having number of observations >=20. Then merge your original data with the data of "after_deletion"; The final ...

本帖被以下文库推荐

沙发
crackman 发表于 2010-3-9 15:47:57
按照这个公司,用SQL按照时间序列统计,看看是否是小于20 然后就delete

藤椅
百草园Tracy 发表于 2010-3-9 15:53:47
crackman 发表于 2010-3-9 15:47
按照这个公司,用SQL按照时间序列统计,看看是否是小于20 然后就delete
你是说要一个一个公司来? 主要是有非常多的公司,输入一个个公司的名字不大现实。
数据很大

板凳
百草园Tracy 发表于 2010-3-9 15:58:09
或者有办法能删除公司名字出现次数少于20次的,应该也可以。
就是不知道怎么操作

报纸
xiaosanmao 发表于 2010-3-9 17:21:33
这个是删除公司出现次数小于2的,看一下:)


data x;
input company$ time;
cards;
001 2
002 4
002 5
002 8
;run;
proc sql;
select * from x  group by company having  count(company)>2;quit;

地板
windlove 发表于 2010-3-9 18:58:14
proc sort data=your_data;
by companies;
proc means data = your_data noprint;
output out=after_deletion(drop = _type_ _freq_ where=(Num_of_price>=20)
             n(stock_series) =Num_of_prices;
by your_companies;
run;

The data of "after_deletion" contains the company names having number of observations >=20.

Then merge your original data with the data of "after_deletion";  The final output will only contain the available companies in "after_deletion".

data final;
   merge your_data(in = yours)
               after_deletion( in = after);
if yours and after;
by your_companies;
run;
已有 1 人评分经验 论坛币 收起 理由
bakoll + 3 + 3 精彩帖子

总评分: 经验 + 3  论坛币 + 3   查看全部评分

7
windlove 发表于 2010-3-9 19:04:28
SAS/SQL is a more efficient way to do it. But I have less experience with SQL,  nearly forget what I have learnt already. Sigh~~~

8
百草园Tracy 发表于 2010-3-10 11:31:14
Thank you all!!!!
Coding is an art!  I really need to learn this well. Thank you very much for your help!

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

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