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 on April 23, and its replacement, statalist.org is already up and running.


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

st: RE: Infix imports wrong numbers!


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Infix imports wrong numbers!
Date   Thu, 1 Jul 2010 15:00:51 +0100

By default -infix- puts ID into a -float- variable, but a -float- cannot hold all 8-digit integers exact. Use a -string- or -long variable for integer identifiers. See the help for -infix- and 

FAQ     . . . . . . . . . . . . . . . . . . . Results of the mod(x,y) function
        . . . . . . . . . . . . . . . . . . . . . N. J. Cox and T. J. Steichen
        2/03    Why does the mod(x,y) function sometimes give
                puzzling results?
                Why is mod(0.3,0.1) not equal to 0?
                http://www.stata.com/support/faqs/data/mod.html

FAQ     . . . . . . . . . . . . . . . . .  The accuracy of the float data type
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . W. Gould
        5/01    How many significant digits are there in a float?
                http://www.stata.com/support/faqs/data/prec.html

FAQ     . . . . . . . . . Comparing floating-point values (the float function)
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  J. Wernow
        3/01    Why can't I compare two values that I know are equal?
                http://www.stata.com/support/faqs/data/float.html

FAQ     . . . . . . . . .  Why am I losing precision with large whole numbers?
        . . . . . . . . . . . . . . . . . .  UCLA Academic Technology Services
        7/08    http://www.ats.ucla.edu/stat/stata/faq/longid.htm

Nick 
n.j.cox@durham.ac.uk 

techné

Hope it is not too odd a question: I have tried to find solutions to
this but could not manage to solve it by myself or surfing the net
I am using infix to import a dataset that has fixed column-content.
The problem is that infix seems "imprecise" in that it imports long
numbers mistaking the last digit, or averaging some variables between
two subsequent observations...
Here is an example:

consider the file test.xxx which is made of the following two lines:

018554079             00002
018554081             00002

I use the command:

infix  	ID   1-9 	EMPTY	10-22 	VAR1	23-27         using   test.xxx

what I obtain is two observations with ID == 018554080 !!!


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