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

From |
"Maarten Buis" <M.Buis@fsw.vu.nl> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Precision |

Date |
Fri, 11 Nov 2005 15:09:43 +0100 |

StatTransfer has the option to import variables as doubles instead of floats, which are accurate up to 16 digits. Do you really need 16 digits? If all the variation occurs in the last digits than you can subtract a very large number like 348080.2688 and than multiply 1000 and you will get the same information with less trouble. Using variables with extremely different variances (e.g. a `normal' variable' with a variance around 1 or 2 and the 16 digit variable with a variance of 1*10^-15) is usually not a good idea in many statistical applications. Stata is usually very good at this, but my gut feeling tells me that 16 digits may be pushing it. If all the variation occurs in the first few digits, than any information in the 16th digit will usually be inconsequential. Hope this helps, Maarten ----------------------------------------- Maarten L. Buis Department of Social Research Methodology Vrije Universiteit Amsterdam Boelelaan 1081 1081 HV Amsterdam The Netherlands visiting adress: Buitenveldertselaan 3 (Metropolitan), room Z214 +31 20 5986715 http://home.fsw.vu.nl/m.buis/ ----------------------------------------- -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Ronnie Babigumira Sent: vrijdag 11 november 2005 12:05 To: statalist@hsphsun2.harvard.edu Subject: st: Precision Dear all I have scanned some of the previous posts on this subject but I am not making any headway. 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); So my question is how can I change x from string to numeric whilst maintaining the precision. Or even better, how best can I import this into stata as a numeric variable without loss of precision. Ronnie * * 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/ * * 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/

- Prev by Date:
**st: RE: Precision** - Next by Date:
**RE: st: Adding lines to graphs** - Previous by thread:
**st: RE: Precision** - Next by thread:
**st: RE: Precision** - Index(es):

© Copyright 1996–2014 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |