Code:
sysuse auto, clear reg price mpg c.mpg#(c.weight c.length c.foreign) , noconstant predict pfit , xb gen pfitalt = _b[mpg]*mpg + _b[c.mpg#c.weight]*mpg*weight+_b[c.mpg#c.length]*mpg*length gen newvar = _b[c.mpg#c.weight]*mpg*weight+_b[c.mpg#c.length]*mpg*length gen newvaralt = pfit-_b[mpg]*mpg

Comment