Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Stop Stata rounding up decimal places when import from Excel


From   Dan Blanchette <dan_blanchette@unc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Stop Stata rounding up decimal places when import from Excel
Date   Thu, 2 Aug 2012 09:28:00 -0400 (EDT)

Sorada,

I tested your value:
 1234567.1234567
and -import excel- by default read in that column as a double
but set the format for that variable to be too small to show all the values...so it looked like Stata rounded it but it
really did not.  Try setting the format to be %15.0g so you
can see the full value.

HTH,
Dan Blanchette

Research Programming Services
Carolina Population Center
University of North Carolina
Dan_Blanchette@unc.edu



On Wed, Aug 1, 2012 at 3:33 PM,  <Sorada.Tapsuwan@csiro.au> wrote:
In my excel file I have one variable that has 7 digits and 7 decimal places, e.g. 1234567.1234567.

When I import the file into Stata, it rounds up the decimal place of the variable to 1234567.12

How can I change the setting so that Stata would not round up my decimal places?

You need to make sure to import that variable as a double not as a float.

For (much) more see :
<http://blog.stata.com/2012/04/02/the-penultimate-guide-to-precision/>

Hope this helps,
Maarten

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index