Dear Statalist, I have a weird situation. While doing some estimations I generate certain scalars based on which I have to define more scalars. See a sample output below from result window.
Code:
. scalar list r s sigma11 sigma12 n0 n1
r = .0001565
s = .10288423
sigma11 = .01725081
sigma12 = .00089302
n0 = 7.3789344
n1 = 2.6271225
. scalar num=r-(sigma12/n0)
. scalar den=s-(sigma11/n1)
. scalar phi=num/den
. scalar list num den phi
num = .00008781
den = .09857153
phi = .0008908
As you can see the listed scalar values are supposed to produce a value of .0008908 for the scalar phi. Whereas, the correct value should be 0.000368334. num and den are also computed wrongly. Without running the whole do-file if I drop all scalars and input the initial scalars one by one and then compute num, den and phi it indeed returns the correct values. Every time I run my do file, I am clearing all previous scalars and obviously the scalar list command before I define scalars num, den and phi gives me the correct values. Yet, the calculation of num den and phi in the do-file produces wrong results. Can someone give some clues what could possibly be wrong.
Thanks.
0 Response to Scalar operation returns inadvertent result
Post a Comment