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

st: RE: strange transfer from MS Excel to Stata


From   "Steichen, Thomas J." <SteichT@rjrt.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: strange transfer from MS Excel to Stata
Date   Mon, 21 Nov 2005 12:03:56 -0500

ghuiber@ups.com writes:
 
> I have an Excel worksheet whose top left corner looks like this:
> 
> year	month	PRODID	SumOfREV	
> 2003	1	CWT	101722355.12	
> 2003	1	GRC	820717456.42	
> 2003	1	GRR	356540317.57	
> 
> Normally, I could simply copy and paste it into the Stata 
> editor. I did that, but the numbers weren't quite the same in 
> Stata. So I saved it as text, and then insheeted it. That did 
> not help. Here is the same top left corner after doing
> 
> insheet using [...], names
> format sumof* %18.2fc
> 
> year	month	prodid	sumofrev
> 2003	1	CWT	101,722,352.00
> 2003	1	GRC	820,717,440.00
> 2003	1	GRR	356,540,320.00
> 
> It's strange when Stata takes it upon itself to round 355.12 
> down to 352, and 317.57 up to 320, isn't it? Does anybody 
> have an idea how to prevent that?

No, not strange... A float variable can only hold 7-8 digits.

Yes, use double precision:
 . insheet using [...], names double

-----------------------------------------
CONFIDENTIALITY NOTE: This e-mail message, including any attachment(s),
contains information that may be confidential, protected by the
attorney-client or other legal privileges, and/or proprietary non-
public information. If you are not an intended recipient of this
message or an authorized assistant to an intended recipient, please
notify the sender by replying to this message and then delete it from
your system. Use, dissemination, distribution, or reproduction of this
message and/or any of its attachments (if any) by unintended recipients
is not authorized and may be unlawful.


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