gen uphitday=1 if high==round(preclose*1.1,.01)
和
gen p=round(preclose*1.1,0.01)
gen uphitday=1 if p==high
得到的结果居然不一样。用的是stata 10.1
谢谢。
|
楼主: outthemirror
|
3054
1
[求助]Stata中为何下面两种代码的结果不同呢? |
|
硕士生 5%
-
|
回帖推荐和stata数据存储和计算时的精度有关,在stata中用 == 运算符必须非常小心。Although you may store your numeric variables as byte, int, long, float, or double, Stata converts all numbers to double before performing any calculations. Consequently, difficulties can arise in comparing numbers that have no finite binary representations.For example, if the variable x is stored as a float and conta ...
本帖被以下文库推荐
| ||
|
|
加好友,备注jltj京ICP备16021002号-2 京B2-20170662号
京公网安备 11010802022788号
论坛法律顾问:王进律师
知识产权保护声明
免责及隐私声明


