楼主: 碧海潇湘
6489 3

[其他] [请问]wide 和long数据的转换问题 [推广有奖]

  • 4关注
  • 11粉丝

已卖:942份资源

博士生

38%

还不是VIP/贵宾

-

威望
0
论坛币
8148 个
通用积分
4.3642
学术水平
13 点
热心指数
10 点
信用等级
8 点
经验
4008 点
帖子
271
精华
0
在线时间
241 小时
注册时间
2007-11-30
最后登录
2023-3-23

楼主
碧海潇湘 学生认证  发表于 2010-12-4 21:08:39 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币

reshape long (变量名1), i((变量名2)) j((变量名3))

谁能够给解释一下,这三个变量分别是什么意思?哪个变量是在转换过程中变化的?哪个是不变的?

O(∩_∩)O谢谢

二维码

扫码加我 拉你入群

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

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

关键词:long wide wid IDE reshape

沙发
baiygggg 发表于 2010-12-4 21:18:49
用help 自己查看吧,好像有例子的

藤椅
蓝色 发表于 2010-12-5 08:30:55
是啊
帮助里面的例子很容易看懂额的
    Before using reshape, you need to determine whether the data are in long or wide form.  You also
    must determine the logical observation (i) and the subobservation (j) by which to organize the
    data.  Suppose that you had the following data, which could be organized in wide or long form as
    follows:


                                            (wide form)           

                                   i         ....... x_ij ........
                                   id  sex   inc80   inc81   inc82
                                   -------------------------------
                                    1    0    5000    5500    6000
                                    2    1    2000    2200    3300
                                    3    0    3000    2000    1000


                                             (long form)      

                                        i     j           x_ij
                                       id   year   sex    inc
                                       -----------------------
                                        1     80     0   5000
                                        1     81     0   5500
                                        1     82     0   6000
                                        2     80     1   2000
                                        2     81     1   2200
                                        2     82     1   3300
                                        3     80     0   3000
                                        3     81     0   2000
                                        3     82     0   1000


    Given these data, you could use reshape to convert from one form to the other:

        . reshape long inc, i(id) j(year)  (goes from top form to bottom)
        . reshape wide inc, i(id) j(year)  (goes from bottom form to top)
已有 1 人评分热心指数 收起 理由
碧海潇湘 + 1 好的意见建议

总评分: 热心指数 + 1   查看全部评分

板凳
碧海潇湘 学生认证  发表于 2010-12-5 11:24:11
弄明白了,谢谢楼上各位

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-5 19:17