Does anyone know if it is possble to use the height and indent options for individual rows in a putdocx table? And, if not is there another way to indent the text of different table rows? I would like to set an indent for categories of variables in a table I am creating (following Schwabish 2020 article on table best practices) but am unable to use either the height() or indent() option in the red line of code here (I set the number of rows, etc in locals above this point in the code that I include below:
local i=`var_row`n''
foreach var of varlist `var_cat`n'' {
local lab: variable label `var'
quietly sum `var' if year==2009 & hhpanel_09_19==1 & not_in_panel==.
putdocx table tableyr(`i',1) = ("`var'")
putdocx table tableyr(`i',2) = ("`lab'")
putdocx table tableyr(`i',3) = (r(mean)), nformat(%5.2f) halign(right)
putdocx table tableyr(`i',4) = (r(sd)), nformat(%5.2f) halign(right)
local i=`i'+1
}
What I can't understand is why this creates an error
putdocx table tableyr(`i',2) = ("`lab'"), indent(0.1pt)
and why this creates an error
putdocx table tableyr(`i',2) = ("`lab'"), height(12pt)
without these options I can create a table like this:
but would prefer one like this:
Thanks for any hlep or advice!
local i=`var_row`n''
foreach var of varlist `var_cat`n'' {
local lab: variable label `var'
quietly sum `var' if year==2009 & hhpanel_09_19==1 & not_in_panel==.
putdocx table tableyr(`i',1) = ("`var'")
putdocx table tableyr(`i',2) = ("`lab'")
putdocx table tableyr(`i',3) = (r(mean)), nformat(%5.2f) halign(right)
putdocx table tableyr(`i',4) = (r(sd)), nformat(%5.2f) halign(right)
local i=`i'+1
}
What I can't understand is why this creates an error
putdocx table tableyr(`i',2) = ("`lab'"), indent(0.1pt)
and why this creates an error
putdocx table tableyr(`i',2) = ("`lab'"), height(12pt)
without these options I can create a table like this:
Difference-in-Differences Sample |
Matched Samples |
|||||||
2009 Sample (n=274) | 2019 Sample (n=274) | Matching Social Media (n=1136) | Matching Coops (n=878) | |||||
Mean | Std. Dev. | Mean. | Std. Dev. | Mean | Std. Dev. | Mean. | Std. Dev. | |
Outcomes | ||||||||
pmilkwetnominal | 0.42 | 0.09 | 1.02 | 0.17 | 1.05 | 0.21 | 1.06 | 0.21 |
pmilkdrynominal | 0.53 | 0.11 | 1.04 | 0.54 | 1.08 | 0.52 | 1.09 | 0.54 |
cattle_price | 1228.89 | 553.33 | 2491.71 | 1302.53 | 2513.86 | 1474.88 | 2462.31 | 1510.42 |
calf_price | . | . | 1040.87 | 679.56 | 950.98 | 483.44 | 916.31 | 406.68 |
coffee_price | 160.05 | 177.62 | 271.43 | 44.13 | 253.75 | 64.02 | 274.80 | 159.53 |
innovative_cattle | 1.38 | 0.74 | 0.97 | 0.66 | 1.03 | 0.71 | 1.05 | 0.71 |
innovative_infra | 0.00 | 0.00 | 0.31 | 0.50 | 0.31 | 0.52 | 0.34 | 0.54 |
innovative_land | 0.17 | 0.37 | 0.70 | 0.97 | 0.70 | 0.97 | 0.74 | 0.98 |
innovative_count | 1.54 | 0.82 | 1.97 | 1.46 | 2.05 | 1.53 | 2.13 | 1.54 |
Treatments | ||||||||
celldum | 0.78 | 0.41 | 0.91 | 0.28 | 0.95 | 0.21 | 0.96 | 0.20 |
socialmedia | 0.00 | 0.00 | 0.67 | 0.47 | 0.75 | 0.43 | 0.66 | 0.47 |
unions | 1.16 | 0.90 | 0.62 | 0.83 | 0.55 | 0.71 | 0.80 | 0.73 |
Difference-in-Differences Sample |
Matched Samples |
|||||||
2009 Sample (n=274) | 2019 Sample (n=274) | Matching Social Media (n=1136) | Matching Coops (n=878) | |||||
Mean | Std. Dev. | Mean. | Std. Dev. | Mean | Std. Dev. | Mean. | Std. Dev. | |
Outcomes | ||||||||
pmilkwetnominal | 0.42 | 0.09 | 1.02 | 0.17 | 1.05 | 0.21 | 1.06 | 0.21 |
pmilkdrynominal | 0.53 | 0.11 | 1.04 | 0.54 | 1.08 | 0.52 | 1.09 | 0.54 |
cattle_price | 1228.89 | 553.33 | 2491.71 | 1302.53 | 2513.86 | 1474.88 | 2462.31 | 1510.42 |
calf_price | . | . | 1040.87 | 679.56 | 950.98 | 483.44 | 916.31 | 406.68 |
coffee_price | 160.05 | 177.62 | 271.43 | 44.13 | 253.75 | 64.02 | 274.80 | 159.53 |
innovative_cattle | 1.38 | 0.74 | 0.97 | 0.66 | 1.03 | 0.71 | 1.05 | 0.71 |
innovative_infra | 0.00 | 0.00 | 0.31 | 0.50 | 0.31 | 0.52 | 0.34 | 0.54 |
nnovative_land | 0.17 | 0.37 | 0.70 | 0.97 | 0.70 | 0.97 | 0.74 | 0.98 |
innovative_count | 1.54 | 0.82 | 1.97 | 1.46 | 2.05 | 1.53 | 2.13 | 1.54 |
Treatments | ||||||||
celldum | 0.78 | 0.41 | 0.91 | 0.28 | 0.95 | 0.21 | 0.96 | 0.20 |
socialmedia | 0.00 | 0.00 | 0.67 | 0.47 | 0.75 | 0.43 | 0.66 | 0.47 |
unions | 1.16 | 0.90 | 0.62 | 0.83 | 0.55 | 0.71 | 0.80 | 0.73 |
Thanks for any hlep or advice!
Comment