Bookmark and Share

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]

st: recast float to integer produces change, but round(var)-var=0


From   maximer@andrew.cmu.edu
To   statalist@hsphsun2.harvard.edu
Subject   st: recast float to integer produces change, but round(var)-var=0
Date   Mon, 21 Jan 2013 19:05:10 -0500

Dear listserv member,

I hope someone can help me with this possibly basic question.

I have a "var" stored as a float.

let

"gen diff = round(var) - var".

I also have:

"count if diff!=0" returns: 0.

However,

"recast int var, force" leads to "X values changed" (where X>0).

I am puzzled, I would have expected "0 values changed". Can someone
provide an explanation.

Many thanks

Maxime Roy




*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index