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

st: Precision questions [was: RE: RE: Majordomo results]


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: Precision questions [was: RE: RE: Majordomo results]
Date   Tue, 20 Apr 2004 19:17:53 +0100

[email protected]
 
> I have posed the questions to Stata tech support, but the answers
> have not been entirely satisfactory.  I would really appreciate your
> help in this:
> 
> 1) Is there a Stata command to export data (to text format for
> example) which does not use the display format of the variables (but
> instead uses the storage format)?

What do you mean by the storage format? -help dta- points to 
information on how data are stored, which you can use to design
your own program. 

> 2) If not, is it possible to export with a dictionary (the reverse of
> infilling with a dictionary), or is this done by manipulating the
> display formats prior to the export?

See -outfile-. 

> 3) How can one make sure that there is no precision lost (however
> insignificant that may be) if one has to export data from a Stata
> file (assuming the import into Stata was done correctly), and does
> not have the "raw data" for comparison purposes (i.e. does formatting
> all vars to something like %17.6f take care of that)?

> For example:
> If I use insheet to import 103192286.98 into Stata, and then outsheet
> the record I get back something like 1.03e+08.  Why is this
> happening?  Stata reads in the variable as a float, and assigns a
> display format of %9.0g.  Even if I change the display format, I
> still get a rounding error (and if I check in the browser, the number
> is 1.03e+08).

You should import such data as -double- variables. Otherwise some 
precision will be lost and no amount of tuning the display format
will put it back again. 

Please use informative titles. 

Nick 
[email protected] 

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