Dear Stata Users,
I've got a problem formatting various tables, which I generate with "table" / "collect layout" in Stata 18 (and add later to a word document with "putdocx collect").
I've got several dummy variables in my dataset, indicating if a respondend mentioned a problem. The variables in the example indicate that the first problem was mentioned once (V401), the second problem was mentioned 8 times (V402), "don't know" was mentioned 4 times.
I would like to seperate the last category, using "collect style cell". This works fine (example 1) until I add a blank line between the categories/variables/dimensions, which I would like to do for clarity. In this case, there are not 1 but 2 border lines (example 2).
The problem also accurs in other tables if 2 or more variables with more than 2 categories are included.
Can "collect style cell, border" and "collect style row stack, spacer" combinded somehow?
Any ideas or workarounds would be appreciated. Thanks a lot!
I've got a problem formatting various tables, which I generate with "table" / "collect layout" in Stata 18 (and add later to a word document with "putdocx collect").
I've got several dummy variables in my dataset, indicating if a respondend mentioned a problem. The variables in the example indicate that the first problem was mentioned once (V401), the second problem was mentioned 8 times (V402), "don't know" was mentioned 4 times.
I would like to seperate the last category, using "collect style cell". This works fine (example 1) until I add a blank line between the categories/variables/dimensions, which I would like to do for clarity. In this case, there are not 1 but 2 border lines (example 2).
The problem also accurs in other tables if 2 or more variables with more than 2 categories are included.
Can "collect style cell, border" and "collect style row stack, spacer" combinded somehow?
Any ideas or workarounds would be appreciated. Thanks a lot!
Code:
* Example generated by -dataex-. For more info, type help dataex collect clear clear input byte(V401 V402 V403) float V033 0 0 0 2 0 1 0 2 0 1 0 1 0 1 0 2 0 0 0 2 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 2 0 0 1 2 0 0 0 1 0 1 0 2 1 1 0 1 0 1 0 1 0 0 0 1 0 0 1 1 0 0 0 1 0 0 0 2 0 0 0 2 0 1 0 1 0 0 1 2 0 0 1 1 0 0 0 1 0 1 0 1 0 0 0 2 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 2 end label variable V033 "Region" label variable V401 "Problem#1" label variable V402 "Problem#2" label variable V403 "don't know" label values V033 V033 label def V033 1 "1. West", modify label def V033 2 "2. East", modify foreach var of varlist V401 V402 V403 { qui table (`var'), /// // distributions nototals /// statistic(percent) /// name(table1) append collect remap result = distribution } foreach var of varlist V401 V402 V403 { qui table (`var') (V033), /// // crosstab nototals /// statistic(percent, across(`var')) /// name(table1) append } collect style header V401 V402 V403, level(hide) // hide level header * example 1 collect style cell V403, /// // seperate last category border(top, pattern(dotted)) collect layout (V401[1] V402[1] V403[1]) (distribution V033) * example 2 collect style row stack, spacer // add a blank line between row dimensions collect layout (V401[1] V402[1] V403[1]) (distribution V033)
Comment