用STATA . xtset company year repeated time values within panel r(451); 怎么解决?

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);

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

第1个回答  2013-04-14

面板里有重复的时间,即单个公司的时间存在重复值;可能在操作的过程中没有删除掉这些重复值。

| 1 1 600028 200509 |
| 1 92 600028 200509 |
| 2 2 600028 200510 |
| 2 93 600028 200510 |

本回答被提问者采纳
第2个回答  2013-06-04
可能跟你的数据有关系,你的year好像是月度数据 你可以help datatime看下如何设置月度数据 然后help xtset看下xtset的时候如何设置 里面有详细解释 应该是后面要加上option
第3个回答  2013-04-16
面板数据有问题
每一个个体都有重复的时间
你drop掉
相似回答