Not sure if I should just be taking this up with STATA directly, but thought I'd check with this community first, just in case anyone has run into the same thing already...
The STATA 17 'collect' set of routines allows a lot of customization of table layouts and formatting, but as far as I've been able to tell the only two options currently implemented for adding vertical spacing between result rows (e.g. regression results) are to either (1) add an entire full row space, e.g.
(which seems excessive), OR (2) to add margin space to the results, e.g. either above or below the coefficients or standard errors:
The problem with the latter approach is that it seems to only render in STATA -- i.e. when the table is exported (esp. to Latex, but also to word) the margin spacing is not retained -- it DOES appear to be maintained (though the scaling is a bit off) when exporting to PDF) [examples of this behavior provided below].
Is there not an option to customize the vertical cell spacing further for Latex or PDF table? (e.g. along the lines of " \addlinespace " in a Latex table?)
Minimum working example:
The STATA 17 'collect' set of routines allows a lot of customization of table layouts and formatting, but as far as I've been able to tell the only two options currently implemented for adding vertical spacing between result rows (e.g. regression results) are to either (1) add an entire full row space, e.g.
Code:
collect style row split, space
Code:
collect style cell result[_r_b], margin( top, width(15) )
Is there not an option to customize the vertical cell spacing further for Latex or PDF table? (e.g. along the lines of " \addlinespace " in a Latex table?)
Minimum working example:
Code:
sysuse auto,clear
replace weight = weight/2000
label var weight "Weight (tons)"
collect clear
collect: reg mpg weight length i.foreign
collect layout (colname#result[_r_b _r_se]) (cmdset)
collect style header result[_r_b _r_se], level(hide) //drop "coef" and "se" labels
collect style showbase off //drop indicator base levels
collect style cell, nformat(%5.2f) //two decimal places
collect style cell result[_r_se], sformat("(%s)") //format s.e.
collect style cell result[_r_se], warn margin( bottom, width(12) ) //add spacing below std. errors
collect preview //spacing changes don't show up in results window, but DO show up in the STATA gui for 'collect' : Statistics >> Summaries, Tables and Tests >> Tables and Collections
collect export "test_table", as(docx) replace
collect export "test_table", as(tex) replace
collect style cell result[_r_se], warn margin( bottom, width(0.5) ) //add spacing below std. errors
collect preview
collect export "test_table", as(pdf) replace

Comment