Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: string function


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: string function
Date   Wed, 9 Jun 2004 18:03:52 +0100

If you look at the help for -string()- 
you will see that the function can 
take one or two arguments. If you 
don't provide the second argument, 
a format, then Stata will necessarily 
use a default format. The answer may 
not indeed not be what you want. 

I guess that you want every digit shown explicitly. 

disp string(10000000, "%12.0f") 

is one way of doing that. In other circumstances, 
some other g or f format may be what you want. 

Nick 
[email protected] 

Lee Chuntao
 
>    I accidentally find that the following line returns a not 
> wanted results
> in my computer. Can u tell me what is the reason?
> 
> . disp string(12000000078)
> 1.20e+10
> 
> .  disp string(00000000)
> 0
> 
> .  disp string(10000000)
> 1.00e+07
> 
> 
> .  disp string(1000)
> 1000
> 
> .  disp string(10000)
> 10000
> 
> .  disp string(100000)
> 100000
> 
> .  disp string(1000000)
> 1000000
> 
> .  disp string(10000000)
> 1.00e+07
> 
> BTW, I use Stata 7.0 SE.
> 
> the display is not what i expected when the number is more 
> than 7 digits

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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