Dear all,
I have a variable, call it e, containing values 0.05(0.05)0.25; I filled this variable with these values manually, meaning I wanted that it contains exactly these values. Now, when I do something like this, for example:
or
in either case, it sometimes works and sometimes does not work. By "it does not work" I mean observations satisfying e == `e' or e == float(`e') are not found for some values of `e'. And by "sometimes" I mean now it works, but when I exit Stata and start it again, it may not work.
But I know that there are observations e=0.05, e=0.10, e=0.15, e=0.20, and e=0.25 because I entered them. I know it's something about precision, I know that how values are displayed is not exactly how they are represented in the machine, which is the reason I tried with the float( ) function, but still I cannot solve the problem.
Please, help!
Best regards,
Ivica
I have a variable, call it e, containing values 0.05(0.05)0.25; I filled this variable with these values manually, meaning I wanted that it contains exactly these values. Now, when I do something like this, for example:
Code:
forval e = 0.05(0.05)0.25 { sum some_variable if e == `e' }
Code:
forval e = 0.05(0.05)0.25 { sum some_variable if e == float(`e') }
But I know that there are observations e=0.05, e=0.10, e=0.15, e=0.20, and e=0.25 because I entered them. I know it's something about precision, I know that how values are displayed is not exactly how they are represented in the machine, which is the reason I tried with the float( ) function, but still I cannot solve the problem.
Please, help!
Best regards,
Ivica
Comment