全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2308 8
2018-08-15
求助,面板数据如何保留前三年和后三年啊
比如我的数据是公司是否采取这项政策,采取了为1, 没采取为0;数据是这个样子
公司名 年 政策
A 2000 0
A 2001 0
A 2002 0
A 2003 0
A 2004 0
A 2005 1
A 2006 1
A 2007 1
A 2008 1
A 2009 1

B 2000 0
B 2001 0
B 2002 0
B 2003 0
B 2004 1
B 2005 1
B 2006 1
B 2007 1
B 2008 1
B 2009 1

如何处理可以把数据变成
A 2002 0
A 2003 0
A 2004 0
A 2005 1
A 2006 1
A 2007 1

B 2001 0
B 2002 0
B 2003 0
B 2004 1
B 2005 1
B 2006 1
求大神指导!




二维码

扫码加我 拉你入群

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

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

全部回复
2018-8-16 09:40:36
你看下这样行吗
proc sql;
create table demotest as
select * from test where company='A' and year in(2002,2003,2004,2005,2006,2007)
union
select * from test where company='B' and year in(2001,2002,2003,2004,2005,2006);
quit;
二维码

扫码加我 拉你入群

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

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

2018-8-16 09:41:00
proc sql;
create table demotest as
select * from test where company='A' and year in(2002,2003,2004,2005,2006,2007)
union
select * from test where company='B' and year in(2001,2002,2003,2004,2005,2006);
quit;
二维码

扫码加我 拉你入群

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

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

2018-8-16 09:42:45
proc sql;
create table demotest as
select * from test where company='A' and year in(2002,2003,2004,2005,2006,2007)
union
select * from test where company='B' and year in(2001,2002,2003,2004,2005,2006);
quit;
二维码

扫码加我 拉你入群

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

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

2018-8-16 09:44:40
proc sql;
create table demotest as
select * from test where company='A' and year in(2002,2003,2004,2005,2006,2007)
union
select * from test where company='B' and year in(2001,2002,2003,2004,2005,2006);
quit;
二维码

扫码加我 拉你入群

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

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

2018-8-16 09:47:10
这个是你要的结果吗
附件列表
1A(((W}SVZIIILWTO{K3UX9.png

原图尺寸 8.21 KB

1A(((W}SVZIIILWTO{K3UX9.png

二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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