楼主: 18959aaa
360 2

[数据管理求助] stata的reshape命令宽数据转长数据一直报错,求帮助 [推广有奖]

  • 0关注
  • 0粉丝

学前班

50%

还不是VIP/贵宾

-

威望
0
论坛币
0 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
33 点
帖子
2
精华
0
在线时间
0 小时
注册时间
2024-5-23
最后登录
2024-5-23

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
我想把数据从宽数据转为长数据,用reshape语句一直报错是为什么?求各位大佬帮助
variable id does not uniquely identify the observations
    Your data are currently wide. You are performing a reshape long. You
    specified i(i) and j(year). In the current wide form, variable i should
    uniquely identify the observations. Remember this picture:

         long                                wide
        +---------------+                   +------------------+
        | i   j   a   b |                   | i   a1 a2  b1 b2 |
        |---------------| <--- reshape ---> |------------------|
        | 1   1   1   2 |                   | 1   1   3   2  4 |
        | 1   2   3   4 |                   | 2   5   7   6  8 |
        | 2   1   5   6 |                   +------------------+
        | 2   2   7   8 |
        +---------------+
    Type reshape error for a list of the problem observations.

我的reshape语句报错(上)

key variables do not uniquely identify the observations
我的gather同样会有报错(上)
i        a1        a2        a3
1        58.3        60.51        62.19
2        45.5        46.57        47.06
3        38.9        39.61        39.72


这是我的数据格式(上)
二维码

扫码加我 拉你入群

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

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

关键词:reshape Stata Shape tata 求帮助 stata命令 Stata专版 stata

沙发
wdlbcj 学生认证  发表于 2024-5-23 15:57:16 |只看作者 |坛友微信交流群
第一行说了  id不是唯一的
你给出的数据格式是没问题的  但是你实际数据是有问题的

使用道具

藤椅
侯思瑶 学生认证  发表于 2024-5-26 11:41:39 |只看作者 |坛友微信交流群
你可以尝试一下:
duplicates drop id,force
reshape long 变量,i()j()

使用道具

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

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-6-16 14:19