The regression command is:

reg price c.weight##c.mpg

This includes weight and mpg as well as their product by treating them as main effects in the interaction between weight and mpg.

If you forget the c. in front of weight and mpg, Stata will assume they're both categorical variables and try to form an indicator for each possible combination of them. Fortunately the resulting error message gives several possible solutions, and the third one is correct.

Last Revised: 1/18/2011