Hi everyone,
I would like to extract a matrix and export it in LaTeX format, but only with two digits after the decimal point with -esttab-. Here is what I tried, without success:
Could anyone help me please? Thank you very much in advance.
Best,
Michael
I would like to extract a matrix and export it in LaTeX format, but only with two digits after the decimal point with -esttab-. Here is what I tried, without success:
Code:
/ All dates, tab product_classification_encode "current" date vs. last
tab tariff_ekon_id_encod tariff_prior_bef062021 if !missing(powers_tariff2_less_15000w) & !missing(powers_tariff2_less_15000w[_n-1]), matcell(U)
mat list U
// Convert to probabilities based on column totals
forval k = 1/`=colsof(U)' {
// totals each column
local total_tar = 0
forval l = 1/`=rowsof(U)' {
local total_tar = `total_tar' + U[`k', `l']
}
di "total col `k' = " `total_tar'
//
forval l = 1/`=rowsof(U)' {
mat U[`k', `l'] = U[`k', `l']/`total_tar'
}
}
mat define U_prime = U'
mat list U_prime, format(%9.2f)
cd "${tables}"
esttab matrix (U_prime) using TransitionalMatrix_TariffTypes_beforeJune21.tex, replace ///
cells("r1(fmt(2)) r2(fmt(2)) r3(fmt(2)) r4(fmt(2)) r5(fmt(2)) r6(fmt(2)) r7(fmt(2)) r8(fmt(2)) ")
Best,
Michael

Comment