********************************** * Import data and only keep 1995 * ********************************** clear set memory 1g use "http://biostat.mc.vanderbilt.edu/wiki/pub/Main/CourseBios312/salary.dta" keep if year==95 ************************************************** * Convert string variables to numeric indicators * ************************************************** * Make a male indicator variable; Female is reference group gen male=. replace male=1 if sex=="M" replace male=0 if sex=="F" table sex male gen arts=. replace arts=1 if field=="Arts" replace arts=0 if field=="Other" | field=="Prof" gen other=. replace other=1 if field=="Other" replace other=0 if field=="Arts" | field=="Prof" table arts field table other field gen malearts = male*arts gen maleother = male*other **** The regression model regress salary male arts other malearts maleother, robust * In females, arts compared to professional test arts * In females, other compared to professional test other * In females, arts compared to other test arts=other * Field effect in females testparm arts other * In males, arts compared to professional test arts+malearts=0 * In males, other compared to professional test other+maleother=0 * In males, arts compared to other test arts+malearts=other+maleother * Field effect in males test (arts+malearts=0) (other+maleother=0) * Salary by gender, contolling for field testparm male malearts maleother * Salary by field, controlling for gender testparm arts other malearts maleother * Effect modifcation (both questions) testparm malearts maleother