如何创建更高维度的table?
How can I create a higher dimensional table?
我想在 Stata 14 中创建一个 table,其中性别的相对频率取决于此人是否受雇:
我曾尝试使用 社区贡献 命令 tabout
,但我还没有找到处理此问题的具体示例。作为一种解决方法,我为一个人生成了一个级别为 "Male & Employed"、"Female & Employed" 等的变量。
有没有不需要生成额外变量的解决方案?
考虑以下使用 Stata 的 auto
玩具数据集的示例:
sysuse auto, clear
egen price2 = cut(price), group(4)
label variable price2 "Price Category"
label define price2 0 "Lower" 1 "Middle" 2 "Upper" 3 "Luxury"
label values price2 price2
recode rep78 (3=1) (4=2) (5=2)
label define rep78 1 "Good" 2 "Poor"
label values rep78 rep78
community-contributed命令tab3way
提供了创建这样的方法cross-tabulations:
tab3way price2 rep78 foreign, rowpct nofreq rowtot format(%5.2f)
Table entries are row percentages
Missing categories ignored
------------------------------------------------------------
| Car type and Repair Record 1978
Price | ------ Domestic ------ ------- Foreign ------
Category | Good Poor TOTAL Good Poor TOTAL
----------+-------------------------------------------------
Lower | 53.85 46.15 100.00 25.00 75.00 100.00
Middle | 76.92 23.08 100.00 25.00 75.00 100.00
Upper | 45.45 54.55 100.00 14.29 85.71 100.00
Luxury | 63.64 36.36 100.00 100.00 100.00
------------------------------------------------------------
我想在 Stata 14 中创建一个 table,其中性别的相对频率取决于此人是否受雇:
我曾尝试使用 社区贡献 命令 tabout
,但我还没有找到处理此问题的具体示例。作为一种解决方法,我为一个人生成了一个级别为 "Male & Employed"、"Female & Employed" 等的变量。
有没有不需要生成额外变量的解决方案?
考虑以下使用 Stata 的 auto
玩具数据集的示例:
sysuse auto, clear
egen price2 = cut(price), group(4)
label variable price2 "Price Category"
label define price2 0 "Lower" 1 "Middle" 2 "Upper" 3 "Luxury"
label values price2 price2
recode rep78 (3=1) (4=2) (5=2)
label define rep78 1 "Good" 2 "Poor"
label values rep78 rep78
community-contributed命令tab3way
提供了创建这样的方法cross-tabulations:
tab3way price2 rep78 foreign, rowpct nofreq rowtot format(%5.2f)
Table entries are row percentages
Missing categories ignored
------------------------------------------------------------
| Car type and Repair Record 1978
Price | ------ Domestic ------ ------- Foreign ------
Category | Good Poor TOTAL Good Poor TOTAL
----------+-------------------------------------------------
Lower | 53.85 46.15 100.00 25.00 75.00 100.00
Middle | 76.92 23.08 100.00 25.00 75.00 100.00
Upper | 45.45 54.55 100.00 14.29 85.71 100.00
Luxury | 63.64 36.36 100.00 100.00 100.00
------------------------------------------------------------