全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
12854 4
2013-04-14
724个公司,91个月,变量有股票价格,汇率变化,市场指数。
数据是这样的
company   year   SR   TR   KSTR   
600028    200509    -5.455200    -0.0012   -0.6669   
600028    200510    -5.084700    -0.00041   -5.3645   
600028    200511    4.846900    -0.00061   0.5754   
600028    200512    13.382000    -0.001   5.663   
600028    200601    6.867000    -0.00113   8.025   
600028    200602    6.224900    -0.00216   3.3078   
600028    200603    -4.536900    -0.00177   -0.0888   
600028    200604    20.198000    -0.00242   11.0469   
600028    200605    6.425000    -5.2E-05   14.0652   
600028    200606    -1.741700    -0.00106   1.9559   
600028    200607    -7.520000    -0.00197   -3.5787   ····
···
就是前面是公司代码,时间是从200509-201303
用duplicate
. duplicates report company year
Duplicates in terms of company year
--------------------------------------
   copies | observations       surplus
----------+---------------------------
        1 |        65880             0
        2 |            4             2
--------------------------------------
. duplicates list company year
Duplicates in terms of company year
  +----------------------------------+
  | group:   obs:   company     year |
  |----------------------------------|
  |      1      1    600028   200509 |
  |      1     92    600028   200509 |
  |      2      2    600028   200510 |
  |      2     93    600028   200510 |
  +----------------------------------+
. duplicates in terms of company year
illegal duplicates subcommand
r(198);
. duplicates in terms of company year
illegal duplicates subcommand
r(198);
. duplicates tag company year, gen(isdup)
Duplicates in terms of company year
. edit if isdup
. drop isdup
. duplicates report company year
Duplicates in terms of company year
--------------------------------------
   copies | observations       surplus
----------+---------------------------
        1 |        65880             0
        2 |            4             2
--------------------------------------
. duplicates list company year
Duplicates in terms of company year
  +----------------------------------+
  | group:   obs:   company     year |
  |----------------------------------|
  |      1      1    600028   200509 |
  |      1     92    600028   200509 |
  |      2      2    600028   200510 |
  |      2     93    600028   200510 |
  +----------------------------------+
. duplicates tag company year, gen(isdup)
Duplicates in terms of company year
. edit if isdup
. drop isdup

. xtset company year
repeated time values within panel
r(451);

怎么解决呢 是哪一步错了?
二维码

扫码加我 拉你入群

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

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

全部回复
2013-4-15 21:54:42
我曾经也出现过这样的问题。
出现重复值,需要强行剔除。
duplicates drop company year, force
再xtest company year, yearly

应该ok,希望有用
二维码

扫码加我 拉你入群

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

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

2016-8-4 20:44:30
Messizsw 发表于 2013-4-15 21:54
我曾经也出现过这样的问题。
出现重复值,需要强行剔除。
duplicates drop company year, force
用这个语句没有发现重复的情况,这种情况怎么解决呢?
二维码

扫码加我 拉你入群

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

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

2019-10-10 21:33:44
七月流水 发表于 2016-8-4 20:44
用这个语句没有发现重复的情况,这种情况怎么解决呢?
是啊,这个要怎么解决呀楼主
二维码

扫码加我 拉你入群

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

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

2020-2-5 22:39:41
七月流水 发表于 2016-8-4 20:44
用这个语句没有发现重复的情况,这种情况怎么解决呢?
请问您最后解决了吗,可以向您请教吗?
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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