Hello all,
I am noticing an annoying leading space before the numbers after I run the code with a di %3.0f and an endash. Which I end up correcting in Word after the putdocx statement I typically have. I don't think it is an MS Word issue. Would love pointers to see if it is a code issue. If I change it to di %3.1f, the spacing issue disappears. There are some variables like number of co-mutations (in my study) for which I cannot have decimals in the reporting.
My code illustration below with the auto dataset.
What it prints:
There is an extra space before both the 3's in the IQR.
I am noticing an annoying leading space before the numbers after I run the code with a di %3.0f and an endash. Which I end up correcting in Word after the putdocx statement I typically have. I don't think it is an MS Word issue. Would love pointers to see if it is a code issue. If I change it to di %3.1f, the spacing issue disappears. There are some variables like number of co-mutations (in my study) for which I cannot have decimals in the reporting.
My code illustration below with the auto dataset.
Code:
sysuse auto, clear local x gear_ratio local unit "cm" local endash = ustrunescape("\u2013") // Code to just do stats around median for one whole group not stratified *--------------------------------------------------------------------------------------------- foreach v of local x{ qui tabstat `v', statistic(p25 p50 p75 min max) save return list local `v'lqr : di %3.0f `=r(StatTotal)[1,1]' local `v'med : di %3.0f `=r(StatTotal)[2,1]' local `v'uqr : di %3.0f `=r(StatTotal)[3,1]' local `v'min : di %3.0f `=r(StatTotal)[4,1]' local `v'max : di %3.0f `=r(StatTotal)[5,1]' local `v'_miqr `"``v'med' `unit' (IQR: ``v'lqr'`endash'``v'uqr' `unit')"' local `v'_mr `"``v'med' `unit' (range: ``v'min'`endash'``v'max' `unit')"' } di "`gear_ratio_miqr'"
Code:
3 cm (IQR: 3– 3 cm)
Comment