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

st: RE: Precision


From   "Steichen, Thomas J." <SteichT@rjrt.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Precision
Date   Fri, 11 Nov 2005 09:16:27 -0500

Ronnie Babigumira writes:
> Sent: Friday, November 11, 2005 6:05 AM
> I have text file with two variables whose contents are 16 
> digit numbers of the form
> 
> x
> 348080.2688552010
> 
> I would like to import the data into stata whilst maintainig 
> the precision. Here is what I have done. I import the 
> variables as strings and that works. However, the next 
> challenge is that they need to be used as numeric variables 
> (this is the hair loss part). I have tried
> 
> gen y = real(x)
> destring x, gen(y)
> 
> Both dont have an option to specify the format. Trying to 
> format the generated variables also wont help since format y 
> %9.11f  gives me the dreaded red lines and blue lines
> 
> invalid %format
> r(120);

Destring will work, as it will automatically generate a double 
precision number having 16 digits of accuracy.

The problem is that you are mis-specifying the format
Try -format y %20.10f-.

Tom

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