Hello,

I am working with a database structured at the firm-year-month level. I am using --tabstat-- to create some summary statistics by the time variable. If I use the option "columns(statistics)", --tabstat-- retains the formatting of the time variable (%tm). However, if I use "columns(variables)", it does not retain the formatting. Is this behavior expected or a bug? Is there a way to format the time variable as %tm in the last table (please, see formating of the "year_month" variable in the first three tables versus the last one in the code below)? If not, can I achieve what I want using --table--? I tried --table--, but was facing the same issue.

Any thoughts are appreciated.

Code:
version 17
cls
clear all

set seed 928502853
set obs 24
gen year_month = tm(2010,Jan) + _n - 1
format %tm year_month

expand 30
bysort year_month: gen firm_id = _n

foreach num of numlist 1(1)3 {
    gen var_`num' = rnormal()
}

tabstat var_1, by(year_month) statistics(mean sd min p25 p50 p75 max count) columns(statistics) format(%9.2fc)
tabstat var_2, by(year_month) statistics(mean sd min p25 p50 p75 max count) columns(statistics) format(%9.2fc)
tabstat var_3, by(year_month) statistics(mean sd min p25 p50 p75 max count) columns(statistics) format(%9.2fc)

tabstat var_1 var_2 var_3, by(year_month) statistics(mean) columns(variables) format(%9.2fc)