We investigate the determinants of high school completion and college attendance, the likelihood of taking science, technology, engineering or math (STEM) courses in the first year of college and the probability of earning a degree in a STEM field. The focus is on women, who tend to be under-represented in STEM fields. Tracking four cohorts of students throughout Florida, women perform nearly as well as men on math achievement tests through high school and are more likely to finish high school and attend college than males. Among college students, however, women are less likely than are men to take courses in the physical sciences in their first year and are less likely to earn a degree in physics or engineering, even after adjusting for pre-college test scores. Gender matching of students and math/science teachers in middle and high school tends to increase the likelihood that female college freshman will take at least one STEM course. However, conditional on first-year coursework, neither gender matching at the secondary or college levels appears to have any effect on the likelihood of completing a major in a STEM field. For all students, having high school math and physics teachers with a degree in math or physics, respectively, (as opposed to education) is associated with a higher likelihood of taking STEM courses as college freshmen.