Displaying numbers in Stata: commas, decimals, and decimal places

There is an easy way to change commas to decimals and vice versa:

set dp comma


set dp period

It can also be changed permanently by adding the option , permanently.

In order to set a limit for the number of decimal places, one simply has to set the format. For the list command of a variable wage, one would normally type

list wage

which gives lots of decimal places, depending on the definition of the variable. In order to restrict it to (say) 2 decimal places, one would type

format wage %9.2fc

or (for using comma):

format wage %9,2fc

The result can be seen by entering: list wage which should display the correctly formatted numbers.

There are lots of other ways to format numbers. For a general overview, press help format.

To the best of my knowledge, this formats are not directly applicable to statistics like sum or regression output. Check the blog-entries for exporting this information. Many export commands support formatting of numbers (see e.g. here).

Leave a Reply