在Stata中创建自定义表格。

huangapple go评论55阅读模式
英文:

creating a custom table in stata

问题

如何创建一个表格,显示2020年、2021年和2022年两个类别:"Old"与"Updated"的均值和标准差?有10个需要总结的变量。

参考图片以获取提示。

我已尝试了asdoc和其他与bysort交互的命令,但每个都显示"指定了太多变量(用于排序)"。

英文:

How can I create a table that shows mean and SD for 2 categories: "Old" versus "Updated" across 2020 2021 and 2022? There are 10 variables that need to be summarized?

See picture for hint.

I have tried stuff like asdoc and other commands interacted with bysort but each says "too many variables (to sort by) specified)

答案1

得分: 2

以下是翻译好的部分:

这是一个非常基本的执行方式。

sysuse auto

tabstat price mpg rep78 headroom trunk weight length, ///
    by(foreign) nototal statistics(mean sd)
英文:

Here is a very basic way of doing that.

sysuse auto

tabstat price mpg rep78 headroom trunk weight length, ///
    by(foreign) nototal statistics(mean sd)

答案2

得分: 2

这是将 tabstat 导出为 CSV 文件的方法:

ssc install estout

sysuse auto

estpost tabstat price mpg weight length if inlist(rep78,3,4,5), by(foreign) ///
statistics(mean sd) columns(statistics) listwise nototal

esttab . using stats.csv, main(mean) aux(sd) ///
replace unstack plain noobs nomtitle

shell open stats.csv
英文:

Here's how you would export tabstat to a csv file:

ssc install estout

sysuse auto

estpost tabstat price mpg weight length if inlist(rep78,3,4,5), by(foreign) ///
statistics(mean sd) columns(statistics) listwise nototal

esttab . using stats.csv, main(mean) aux(sd) ///
replace unstack  plain noobs nomtitle 

shell open stats.csv

huangapple
  • 本文由 发表于 2023年7月28日 03:08:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76782750.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定