Thanks to Christopher F Baum of Deutsches Institut für Wirtschaftforschung,
-autofmt- is available from ssc.
-autofmt- provides a fast and easy way to format a signficant number of digits.
It uses the same algorithm found in -outreg2-. It is the same
algorithm found in
a few other programs that claims to do the same thing, including cases where
the same exact codes were copied-and-pasted into another program. Borrowing
original codes and ideas are fine, especially when they are clearly documented
in the acknowledgment section of the help file.
Enough informaiton is returned so that a user can produce their own output.
. autofmt, input(-1.367456 -0.0000925 -0.5623 -13.5678) dec(3) strict
. ret list
scalars:
r(deci4) = 1
r(deci3) = 3
r(deci2) = 7
r(deci1) = 2
macros:
r(output4) : "-13.6"
r(input4) : "-13.5678"
r(fmt4) : "1f"
r(output3) : "-0.562"
r(input3) : "-0.5623"
r(fmt3) : "3f"
r(output2) : "-9.25e-05"
r(input2) : "-0.0000925"
r(fmt2) : "2e"
r(output1) : "-1.37"
r(input1) : "-1.367456"
r(fmt1) : "2f"
Roy
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/