楼主: liuliumuzi02
13549 18

[数据管理求助] xtset总是报错,提示数据是mi set [推广有奖]

  • 0关注
  • 0粉丝

VIP1

本科生

44%

还不是VIP/贵宾

-

威望
0
论坛币
1185 个
通用积分
1.0000
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
146 点
帖子
6
精华
0
在线时间
178 小时
注册时间
2019-3-7
最后登录
2021-4-12

相似文件 换一批

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
求助,数据经过merge之后明明已经是面板数据,为什么在xtset id year 的时候,总是报错,提示“no; data are mi set
    Use mi xtset to set or query these data; mi xtset has the same syntax as xtset.”
二维码

扫码加我 拉你入群

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

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


微信图片_20200211131723.jpg (522.71 KB)

微信图片_20200211131723.jpg

沙发
黃河泉 在职认证  发表于 2020-2-11 15:49:59 |只看作者 |坛友微信交流群
你若要问程序,永远附上相关资料 (请不要用截图);若附上资料,永远用 dataex 印出资料。
•        先 ssc install dataex (并见说明),将原始 Stata 资料中具有”代表性”的一部分资料列出,以供有意回答者实验之用,并能提供具体操作指令。
•        请参考说明 https://bbs.pinggu.org/thread-5048204-1-1.html

使用道具

藤椅
liuliumuzi02 发表于 2020-2-11 19:37:04 |只看作者 |坛友微信交流群
黃河泉 发表于 2020-2-11 15:49
你若要问程序,永远附上相关资料 (请不要用截图);若附上资料,永远用 dataex 印出资料。
•        先 ssc  ...
不好意思,我重新上传我的数据如下:
  1. * Example generated by -dataex-. To install: ssc install dataex
  2. clear
  3. input long id double(year ln_income certified household_size hhead_age)
  4. 1 2011  8.476579508530941 . 4  .
  5. 1 2013  8.293136723520464 . 3  .
  6. 1 2015  9.371268024390902 2 3 60
  7. 2 2011  9.286467732363734 . 5  .
  8. 2 2013 10.564154799752378 . 5  .
  9. 2 2015  9.026537696895206 2 5 65
  10. 3 2011   7.13966033596492 . 2  .
  11. 3 2013  9.234662184121248 . 2 61
  12. 3 2015  8.764209478536243 2 2  .
  13. 4 2011  8.862341963516347 . 5  .
  14. end
  15. label values id id
  16. label def id 1 "201100637", modify
  17. label def id 2 "201100638", modify
  18. label def id 3 "201100639", modify
  19. label def id 4 "201100640", modify
复制代码

使用道具

板凳
znxkxx 发表于 2020-2-11 23:11:12 |只看作者 |坛友微信交流群
Just  follow help manual:

Remarks

    If you have set your data with any of the above commands before you mi set them, there is no problem; the settings were automatically
    imported.  Once you mi set your data, however, you will discover that Stata's other set commands no longer work.  For instance, here is
    the result of typing stset on an mi set dataset:

        . stset ...
        no; data are mi set
            Use mi stset to set or query these data; mi stset has the same syntax as stset.

            Perhaps you did not type stset.  Some commands call stset to obtain information about the settings.  In that case, that command is
            not appropriate for running directly on mi data.  Use mi extract to select the data on which you want to run the command, which is
            probably m=0.
        r(119);

    Also, you might sometimes see an error like the one above when you give a command that depends on the data being set by one of Stata's
    other set commands.  In general, it is odd that you would be running such a command directly on mi data because what you will get will
    depend on the mi style of data.  Perhaps, however, you are using mi wide data, where the structure of the data more or less corresponds to
    the structure of non-mi data, or perhaps you have smartly specified the appropriate if statement to account for the mi style of data you
    are using.  In any case, the result might be

        . some_other_command
        no; data are mi set
            Use mi XXXset to set or query these data; mi XXXset has the same syntax as XXXset.

            Perhaps you did not type stset.  Some commands call stset to obtain information about the settings.  In that case, that command is
            not appropriate for running directly on mi data.  Use mi extract to select the data on which you want to run the command, which is
            probably m=0.
        r(119);

    Substitute one of the set commands listed above for XXXset, and then understand what just happened.  You correctly used mi XXXset to set
    your data, you thought your data were set, yet when you tried to use a command that depended on the data being XXXset, you received this
    error.

    If this happens to you, the solution is to use mi extract to obtain the data on which you want to run the command -- which is probably
    m=0, so you would type mi extract 0 -- and then run the command.

使用道具

报纸
黃河泉 在职认证  发表于 2020-2-12 08:07:42 |只看作者 |坛友微信交流群
liuliumuzi02 发表于 2020-2-11 19:37
不好意思,我重新上传我的数据如下:
这个例子没问题,请自己
  1. xtset id year
复制代码

使用道具

地板
jxapp_53753 发表于 2020-5-26 22:08:16 来自手机 |只看作者 |坛友微信交流群
您好!请问这个问题后来怎么解决的?我也遇到了这个问题

使用道具

7
灞上柳生 发表于 2020-11-2 22:03:51 |只看作者 |坛友微信交流群
请问大家后来都是如何处理的?我也遇到了同样的问题。

使用道具

8
zdjok 发表于 2021-7-26 15:17:12 |只看作者 |坛友微信交流群

请问大家后来都是如何处理的?我也遇到了同样的问题。

使用道具

9
日新少年 学生认证  发表于 2021-8-23 16:53:00 |只看作者 |坛友微信交流群
试试如下代码,年份根据自己需要改。我是这样解决的。
destring hhid,replace
gen _mi_miss = (hhid==.)
mi unset
xtset hhid year
xtbalance,range(2013 2017)

使用道具

10
luckui 发表于 2021-10-22 00:22:23 |只看作者 |坛友微信交流群
日新少年 发表于 2021-8-23 16:53
试试如下代码,年份根据自己需要改。我是这样解决的。
destring hhid,replace
gen _mi_miss = (hhid==.)
...
你好!请问最后一步xtbalance是什么意思?前面都可以运行,最后一步显示command xtbalance is unrecognized

使用道具

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

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

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

GMT+8, 2024-4-28 18:20