Hello. I am trying to save a collect style (for logistic regression) and am struggling with preventing macro expansion. Specifically, the two lines of code in bold:
collect clear
collect layout (colname) (result[_r_b _r_se _r_z _r_p _r_ci])
collect style cell result[_r_b _r_se], nformat(%6.2f)
collect style cell result[_r_p], nformat(%5.3f)
collect style cell result[_r_ci], nformat(%5.2f) sformat("[%s]") cidelimiter(,)
collect style cell cell_type[column-header], halign(center)
collect style column, extraspace(1)
collect style showbase factor // off
collect style row stack, nobinder delimiter(" x ")
collect style cell border_block, border(right, pattern(nil))
collect title "Table X. \`e(depvar)': \`: var lab \`e(depvar)''"
collect notes "Pseudo R-squared = \`: di %9.3f e(r2_p)', Wald chi2(4) =\`: di %9.2f e(chi2)', Prob > chi2 =\`: di %9.4f e(p)'"
collect style putdocx, layout(autofitcontents)
collect style save logstyle, replace
When I see the .stjson file, the macros have been expanded despite the \ character and replaced with nothing:
"notes": [
"Pseudo R-squared = ., Wald chi2(4) = ., Prob > chi2 = ."
],
"title": "Table X. :"
}
I know I can manually add these macros directly in the .stjson file, but would prefer to avoid doing this. Any suggestions very welcome. Thanks!
collect clear
collect layout (colname) (result[_r_b _r_se _r_z _r_p _r_ci])
collect style cell result[_r_b _r_se], nformat(%6.2f)
collect style cell result[_r_p], nformat(%5.3f)
collect style cell result[_r_ci], nformat(%5.2f) sformat("[%s]") cidelimiter(,)
collect style cell cell_type[column-header], halign(center)
collect style column, extraspace(1)
collect style showbase factor // off
collect style row stack, nobinder delimiter(" x ")
collect style cell border_block, border(right, pattern(nil))
collect title "Table X. \`e(depvar)': \`: var lab \`e(depvar)''"
collect notes "Pseudo R-squared = \`: di %9.3f e(r2_p)', Wald chi2(4) =\`: di %9.2f e(chi2)', Prob > chi2 =\`: di %9.4f e(p)'"
collect style putdocx, layout(autofitcontents)
collect style save logstyle, replace
When I see the .stjson file, the macros have been expanded despite the \ character and replaced with nothing:
"notes": [
"Pseudo R-squared = ., Wald chi2(4) = ., Prob > chi2 = ."
],
"title": "Table X. :"
}
I know I can manually add these macros directly in the .stjson file, but would prefer to avoid doing this. Any suggestions very welcome. Thanks!