[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Inconsistent Result of generating variables
At 09:22 PM 4/9/2004 -0400, Jitian Sheu wrote:
I hope you mean you got the same results as I did, not the same incorrect
results you got earlier! Anyway, here is the Stata FAQ I was thinking of -
"I coded 'a'2 and got the wrong sign. Why?" See
Hello, Thank you very much.
Based on your explaination, I try to use: (`b21')^2 instead of using
Stata creates the same results.
The trick is that when you say,
You naturally assume that Stata will think `b21' means "negative
.25". But, Stata actually interprets it as "minus .25". Hence, with
`b21'^2, exponentiation gets done first and then subtraction, leaving you
with -.0625 rather than +.0625.
The FAQ suggests two workarounds:
* Use scalars instead of local macros, e.g.
scalar b21 = -.25
* Or, bind the macro in parentheses when taking powers, e.g
* For searches and help try: