user2146441
user2146441

Reputation: 228

Stata: Format for millions ( '000,000s' ) to three decimal places

What's the format for displaying numbers in terms of millions to two decimal points?

sysuse auto, clear
gen millions = price * 1000
estpost su millions, detail
esttab, replace noisily  cells("count(fmt(%12.2gc) label(# Obs))sum(fmt(%12.2gc) label(Sum))") ///
noobs nomtitle nonumber booktabs  label  collabels(none) gaps f eqlabels(none)  posthead("")

For example, I want the code above to display 456.229 rather than 456,229,000.

Upvotes: 2

Views: 4215

Answers (1)

Nick Cox
Nick Cox

Reputation: 37208

Official Stata has no special display format for millions. You must divide by a million first, even if you do that on the fly. di %4.3f 456229000/1e6 would work.

. di %4.3f 456229000/1e6
456.229

You cite estpost and esttab. It is a good convention to explain where user-written programs such as these come from. User-written programs may have their own extensions of Stata's display formats, but you should expect any such to be documented.

Upvotes: 3

Related Questions