想把个人数据中基本医疗保险变量以家庭为单位进行整理,因此选用reshape命令,将长数据转换为宽数据,具体如下:
use "chfs2015_ind.dta",clear
keep hhid_2015 pline hinsurance1
reshape wide hinsurance1, i(hhid_2015) j(pline)
该命令在处理CHFS2015和2017年数据时顺畅无误,但是在处理2019年数据时遇到问题,显示错误如下:
no; data are mi set
Use mi reshape to perform reshape on these data. mi reshape has the same syntax as reshape.
Perhaps you did not type reshape. In that case, the command you typed calls reshape and it is not appropriate for
use with mi data. Use mi extract or mi xeq to select the data on which you want to run the command, which is
probably m=0.
后续尝试使用mi reshape mi extract与mi xeq都无法运行。
本科小白对数据处理不精,还望各位大佬指教,谢谢!