| Previous: How can I set | Up: Frequently Asked Questions | Next: How can I use |
estsimp regress y x1x2
If you wish to set X1X2 to its mean, then you can use setx in the normal way:
setx x1x2 mean
However, if you want to set X1X2 to the product of the means of X1 and X2 (rather than the mean of the product), then you have two choices. First, you could set the values by hand, e.g.,
setx x1x2 10*12
where 10 is the mean of x1 and 12 is the mean of x2.
However, an even better method is the following sequence of commands:
summarize x1, meanonly /* Compute the mean of x1 */ local mx1=`r(mean)' /* Save the mean in a local macro */ summarize x2, meanonly /* Compute the mean of x2 */ local mx2=`r(mean)' /* Save the mean in a local macro */ setx x1x2 `mx1'*`mx2' /* Setx to mean(x1)*mean(x2) */