我想将我的数据转置,怎么办? | 您所在的位置:网站首页 › stata出现r622怎么办 › 我想将我的数据转置,怎么办? |
都可以,就是xpose直观一些,但要对变量重新命名,reshape对数据结构有一定要求,我的老出错,必须将一些字符型的变量删掉才能用。 如我的数据:http://wangzengtao.googlepages.com/urban.dta 我用reshape时我得把变量:item和aver删掉,然后再用,不然提示出错: . use urban.dta, replace. *drop aver item. keep if year==2003(0 observations deleted). reshape long l, i(id) j(level)(note: j = 1 2 3 4 5)Data wide -> long-----------------------------------------------------------------------------Number of obs. 9 -> 45Number of variables 9 -> 6j variable (5 values) -> levelxij variables: l1 l2 ... l5 -> l-----------------------------------------------------------------------------. reshape wide l, j(id) i(level)(note: j = 1 2 3 4 5 6 7 8 9)item not constant within levelaver not constant within levelType "reshape error" for a listing of the problem observations.Xpose很方便,但要对变量重新命名,当变量很多的时候有点麻烦。。。。。不知道能不能批量重命名。比如将v1 v2 v3 命名为item2 item3 item4? [此贴子已经被作者于2008-4-21 4:57:42编辑过] |
CopyRight 2018-2019 实验室设备网 版权所有 |