Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

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

From |
"Beede, David N" <dbeede@doc.gov> |

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

Subject |
st: limit to number of digits that can be precisely input into a Stata dataset using -insheet-? |

Date |
Mon, 14 May 2012 16:50:31 -0400 |

Is 15 the maximum number of digits one can safely (i.e., precisely) input into a Stata dataset using -insheet-? I've seen in the statalist archives someone saying that "about 16" is the limit (which I assume is related to the precision for double being 1.414 e-16 (according to the "data types" article in the documentation). I'm a little bit nervous because I have been reading in csv file using -insheet- with Census Block identification numbers which are 15 digits long without any apparent problems, but when I used -insheet- to read in an id number that was 19 digits long the resulting Stata dataset did not retain the full 19 digits of precision. I know this is not a very scientific demonstration, but... . type test.csv 500019601001002,5000196010010022,50001960100100222,500019601001002222,5000196010010022222 . insheet using test.csv, clear comma nonames (5 vars, 1 obs) . . forvalues x=1(1)5 { 2. local y=`x'+14 3. gen str`y' s`x' = string(v`x', "%0`y'.0f") 4. } . l s* +-----------------------------------------------------------------------------+ 1. | s1 | s2 | s3 | s4 | | 500019601001002 | 5000196010010022 | 50001960100100224 | 500019601001002240 | |-----------------------------------------------------------------------------| | s5 | | 5000196010010021900 | +-----------------------------------------------------------------------------+ David N. Beede, Ph.D. Economist Office of the Chief Economist Economics & Statistics Administration (www.esa.gov) U.S. Department of Commerce Office: Room 4868A Mailstop: Room 4858 HCHB 1401 Constitution Avenue, N.W. Washington, DC 20230 Telephone (202) 482-1226 dbeede@doc.gov LinkedIn: http://www.linkedin.com/in/davidbeede * * 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/

**Follow-Ups**:**Re: st: limit to number of digits that can be precisely input into a Stata dataset using -insheet-?***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**Re: st: Statistical tests under heteroskedasticity** - Next by Date:
**Re: st: limit to number of digits that can be precisely input into a Stata dataset using -insheet-?** - Previous by thread:
**st: New version of -somersd- on SSC** - Next by thread:
**Re: st: limit to number of digits that can be precisely input into a Stata dataset using -insheet-?** - Index(es):