Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: precision: -insheet- & -outsheet-


From   [email protected]
To   [email protected]
Subject   st: precision: -insheet- & -outsheet-
Date   Tue, 4 Apr 2006 14:44:34 -0700 (PDT)

Hello All,
I am using Stata S/E 9.1 for Macintosh.

This question concerns the issue of retaining data precision, as it were,
when -insheeting- data into Stata from a .csv file and, conversely, when
exporting data from Stata via -outsheet-.

Suppose I have an Excel file that contains large numbers that are
presented as scientific notation.  Further suppose that I save said Excel
file as a comma-delimited file (.csv) then import into Stata via
-insheet-, along w/ the double option.  After the insheet, an examination
of the data indicates that some degree of precision has been lost --
rounding -- even after the variables have been reformatted to reflect the
length & desired format (e.g. %20.2fc).  One clumsy workaround for this
problem involves changing the numeric variable to string via the insertion
of commas into the values, -insheet-ing, then -destring-ing the variable
back into a numeric variable.  As noted, this seems like a terribly
cumbersome and clumsy solution -- any suggested alternatives (e.g. using
an alternative to -insheet-)??

On the flip side, i.e. -outsheet-ing the data back into a .csv file, is it
necessary to format any numeric variables into non-scientific notation
format so as to retain the actual values of the variables?

I browsed the statalist archives and although there are multiple threads
that discuss this topic, I was unable to find anything w/ this particular
angle.  I also browsed the online- and print-documentation, but to little
avail.

Many thanks in advance,
Clint


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