Solution

First create an indicator variable for whether a car has mpg>25:

gen highMPG=mpg>25

Then test whether the subsample with highMPG=1 has a different mean from the subsample with highMPG=0:

ttest weight, by(highMPG)

Last Revised: 12/18/2009