【发布时间】:2013-01-25 15:25:16
【问题描述】:
我需要将在 Stata 中创建的几个矩阵导出到已经存在的 excel 文件的几个不同的专门命名的工作表中。这将是使用 xlswrite() 在 Matlab 中的小菜一碟。我在 Stata 中找不到类似的命令。
"xml_tab" 可以,但它似乎不想让我打开并更改 已经存在的 excel 文件。它总是从创建一个新的 excel 文件开始。
对于如何获得“xml_tab”或其他一些 Stata 命令来打开一个已经存在的 excel 文件,对其进行更改(用新矩阵覆盖特定工作表),然后保存它,我将不胜感激覆盖我不想触摸的其他工作表上的所有其他内容。
Stata 能做到吗?
谢谢
编辑:
我需要做的一个例子是:
*Define poverty line
scalar povlin=29347.5
*1) SETUP sheet
mat SETUP=(1,J(1,3,0),1,J(1,2,0),1,1,J(1,5,0),povlin)
/* Here I need to export the matrix SETUP to sheet "SETUP" in an
already existing excel file. In matlab it would be
xlswrite('filename','SETUP','A2') */
*2) FARM sheet
tabstat acres,stat(sum) save
mat acrtot=r(StatTotal)
tabstat aehh07 offrinc07,save
mat vmeans=r(StatTotal)
mat maehh=vmeans[1,1]
mat moffrinc=vmeans[1,2]
tabstat aehh07 offrinc07 acres,stat(cv) save
mat CV=r(StatTotal)
tabstat acres,save
mat macres=r(StatTotal)
mat FARM=(1,acrtot,maehh,CV[1,1],moffrinc,CV[1,2],moffrinc,CV[1,2],J(1,3,0),macres)
/* Here I need to export the matrix FARM to sheet "FARM" in the
same already existing excel file where I put the SETUP matrix. In matlab it would
be xlswrite('filename','FARM','A2') */
我需要为几张纸做这种事情。
【问题讨论】:
-
这将是尼克矩阵分类中的 (b)。