Statalist The Stata Listserver


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

Re: st: Generate puzzle


From   Rafal Raciborski <rafal.raciborski@emory.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Generate puzzle
Date   Sat, 28 Jan 2006 15:01:27 -0500

this is because x2 is generated as a float.  use

gen double x2=10*x

see -help data types-

rafal


Quoting Andrzej Niemierko <aniemierko@PARTNERS.ORG>:

Could someone please explain to me the following strange behaviour? When I
generate a new variable:
gen x=3366161 and then:
gen x2=10*x1
the number that I get for x2 is 33661608 (not the correct number 33661610).
When the initial x1 number is 3366162 the x2 is correct, that is 33661620.
Any help?
Andrzej

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



================
Rafal Raciborski
Graduate student
Department of Political Science
Emory University
301 Tarbutton Hall
1555 Dickey Drive Atlanta, GA 30322
404-378-9826 (home)
rafal.raciborski@emory.edu
http://www.roofoos.net/


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