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

Re: st: Inputting large numbers


From   Joseph Coveney <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: Inputting large numbers
Date   Sun, 04 Jul 2004 11:03:48 +0900

jockmcdock wrote:

Recently, a poster posted a question about converting a long string which 
contained "numeric" data to numeric. I recently had the same problem and 
eventually solved it. While trying to solve my problem, I looked at inputting 
large integers and came across the following

. set obs 1
. gen x=1234567890
. format x %15.0g

. list

     +------------+
     |          x |
     |------------|
  1. | 1234567936 |
     +------------+

Is there some limit on the size of integers (answer: of course there is) but 
why doesn't Stata give me some sort of warning message?

--------------------------------------------------------------------------------

-help datatypes- will give you the limits on the various floating-point and 
integer representations of numbers in Stata.  It also describes the default 
storage type for numeric (float) for -generate- and states its accuracy (about 
7 digits), which is the warning that you need about this, if the result of 
-list- with the default display format isn't enough (1.23e+09).  The User's 
Guide [U] and Reference [R] manuals are also good resources for these kinds of 
matters.  You can change the default for -generate- by -set type double-, which 
will overcome the problem in this particular example.  (See -help generate-.)

Joseph Coveney


*
*   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