If you are programming in Stata, or using macros for any reason, be careful when squaring.
Try the following if interested (commands in italics), though you can see the result:
gl check = -.01
di $check-.01
di $check^2
-.0001
di ($check)^2
.0001
This was done on Stata 8.2 but I also found this to issue on Stata 9.
Wednesday, December 12, 2007
Subscribe to:
Post Comments (Atom)
1 comment:
Turns out there is an understandable reason for this. The macros are read before any operation is done, then the order of operations places ^ before -. Good to know though.
Post a Comment