楼主: shushu408
117169 73

[stata资源分享] 如何将一般的数据转化为面板数据   [推广有奖]

61
hzdgt 在职认证  发表于 2021-8-15 21:39:29
reshape wide Y X1 X2,i(id)        j(year)
结果出现:
variable year not found
Data are already wide.
怎么办呢?望赐教!

62
hzdgt 在职认证  发表于 2021-8-15 22:09:48
reshape long Y X1 X2,i(id)   j(year)就可以了,原来是命令错了。多谢!

63
1255957038 发表于 2021-11-15 20:42:11
Klaus777 发表于 2016-8-23 12:30
variable id does not uniquely identify the observations
    Your data are currently wide.  You are  ...
将id改为1,2,3,这样命名,我一开始用的省份的拼音发现也是你这个问题,后来改成1~30数字,就可以了

64
kairoc 在职认证  发表于 2022-1-12 19:17:18
非常感谢

65
hujing1 发表于 2022-1-14 18:49:50
Klaus777 发表于 2016-8-23 12:30
variable id does not uniquely identify the observations
    Your data are currently wide.  You are  ...
我也是这样,请问您解决了吗,怎么解决的呢

66
lyx00001 学生认证  发表于 2022-3-10 16:39:24
求问怎么从第一张图整理成第二张图的呀

67
zhang-97 发表于 2022-4-20 19:52:11
hujing1 发表于 2022-1-14 18:49
我也是这样,请问您解决了吗,怎么解决的呢
可以把命令中变量名改成小写,或许就能成功,我就是这样成功的!

68
sherrchow 发表于 2022-9-30 16:02:12
顶,看了很多个,就这个有用了

69
戴晓颖 学生认证  发表于 2023-1-2 18:21:35
Klaus777 发表于 2016-8-23 12:30
variable id does not uniquely identify the observations
    Your data are currently wide.  You are  ...
求问博主解决了吗?

70
SALTYFISHFIELD 学生认证  发表于 2023-8-15 12:10:58
Klaus777 发表于 2016-8-23 12:30
variable id does not uniquely identify the observations
    Your data are currently wide.  You are  ...
这是一个很简单的问题,报错已经很直白了,id should uniquely identify the observations。也就是每一年id对应的观测应该是唯一的,对原数据进行duplicates drop id, force,之后再reshape long var, i(id) j(year)应该就可以解决问题。

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-11 19:44