Put it into Practice

Now it’s time to try things out for yourself. Complete each of the following steps, based on what we learned in this chapter.

Unless your instructor tells you otherwise, use an do-file to execute all code needed to accomplish the following:

  1. Load in the Vulnerable Neighborhoods Survey dataset (vns.dta).1 You can download it here and save it on your computer. Or you can load the file directly into Stata through the Internet with the following URL: https://learndata.net/vns.dta
  1. Find the means and medians of avg_disgust by gender (i.e., for females and for males).

  2. Create a boxplot to compare avg_disgust across genders.

  3. Create a binary variable indicating perceived discrimination. “Yes” should be coded as 1, “No” should be coded as 0, and “Don’t know” should be coded as missing. Create a two-way frequency table that shows how this new variable maps to the original variable, including missing values.

After completing all of this, you should save your do-file in a folder that is convenient to access. If you are submitting work to an instructor, they will likely want you to send them both your do-file and a Word doc containing your results.


  1. This is a modified version of data obtained from Sønderskov and colleagues: https://doi.org/10.17605/OSF.IO/62BV5 (CC-BY 4.0)↩︎