format设置固定格式,比如%9.3f即可。
具体解释:
The %f format
In %w.df, w is the total output width, including sign and decimal point,
and d is the number of digits to appear to the right of the decimal
point. The result is right-justified.
The number 5.139 in %12.2f format displays as
----+----1--
5.14
When d==0, the decimal point is not displayed. The number 5.14 in %12.0f
format displays as
----+----1--
5
%-w.df works the same way, except that the output is left-justified in
the field. The number 5.139 in %-12.2f displays as
----+----1--
5.14
详见官网解释:
http://www.stata.com/help.cgi?format#fformat