excel - 将 png 图形文件从 Stata 写入 Excel

标签 excel stata

我想在 Stata 中创建图形,并将基础图形数据(不是生成它们的原始数据)连同图形文件一起导出到 Excel。我想我坚持使用 StataCorp ( http://www.stata.com/manuals14/pputexcel.pdf ) 的 putexcel 官方代码文档,但我不断收到以下错误消息:

picture: expression must be enclosed in ()

当我将相关代码行括在括号中时,出现错误

unknown function picture()

对此有何建议或提示?请参阅下面的可立即运行的代码示例。

sysuse auto, clear
* ------ place for some data manipulations (snip) -----------

tempfile data
save `data'

* plotting
graph bar price foreign
graph export "test.png", replace

* Export plot data (works only w/o by-option in graph command)
serset use
export excel "graphdata.xlsx", sheet("test") firstrow(variables) sheetreplace
putexcel H20 = picture(test.png) using "graphdata.xlsx", sheet("test") modify
serset clear

* re-use original data and plot next graph
use `data', clear

*...

最佳答案

这是否符合您的要求:

sysuse auto
export excel using "myresults.xlsx", replace sheet("Data")
graph bar price foreign
graph export "test.png", replace
putexcel set "myresults.xlsx", sheet("Graph") modify
putexcel A1 = picture(test.png)

关于excel - 将 png 图形文件从 Stata 写入 Excel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40407069/

相关文章:

vba - 如何找到数组的维数?

没有上边框和边距的 Stata 图

excel - 删除重复值但保留其余行值

python - Arelle 使用 Python 自动化将数据传输到 Excel 的小程序

r - 在 R 中循环遍历列并找到第一个值等于 1

Stata estpost esttab : Generate table with mean of variable split by year and group

r - 在R中加载stata.dta文件并进行数据分析

formatting - 更改 esttab 中列的小数位而不是行

VBA - 查找重复并比较其中哪一个是最高的

excel - 从 Excel 中的每 4 列复制数据