Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: significant digits format


From   Jacob Wegelin <[email protected]>
To   [email protected]
Subject   st: significant digits format
Date   Mon, 11 Jan 2010 15:03:54 -0500 (EST)

The -string- command can be combined with a format to render a number as a string with a specified number of decimal places. For instance:

. display string(_pi, "%9.2f")
3.14

. display string(_pi / 100, "%9.2f")
0.03

. display string(_pi / 100, "%9.4f")
0.0314

. display string(_pi * 100, "%9.4f")
314.1593

Am I correct in believing that no comparable method exists for generating a string that shows a specified number of significant digits?

For example, suppose the function was called -sigdig-. Then we would get the following results:

display sigdig( _pi, 3 )

3.14

display sigdig( _pi / 100, 3 )

.0314

display sigdig( _pi * 100, 3 )

314

A google search brings up -esttab-, which evidently creates nice tables of output from regression models. I had in mind however a more general tool.

Thanks for any pointers

Jacob A. Wegelin
Assistant Professor
Department of Biostatistics
Virginia Commonwealth University
730 East Broad Street Room 3006
P. O. Box 980032
Richmond VA 23298-0032
U.S.A. URL: http://www.people.vcu.edu/~jwegelin
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index