Qualitative-Quantitative Relationships

Key concepts/commands:

  1. clear all: empty out not just the current dataset but also other things stored in Stata’s memory

    clear all
  2. bys: repeat a command for different subsets of the data

    bys schooltype: sum combined_score, detail
  3. over() option: for many graphs, allows for grouping by a qualitative variable

    graph box combined_score, over(schooltype)
  4. encode: create a numeric version of a string variable

    encode overallgrade, gen(grade_factor)
  5. replace: change (some) values for a variable

    replace grade_A = 1 if overallgrade == "A"
  6. if: impose a restriction on a command (e.g., only apply to certain observations)

    replace grade_A = 1 if overallgrade == "A"
  7. ==: check whether two things are equal

    replace grade_A = 1 if overallgrade == "A"
  8. !=: means “not equal” (the exclamation point means “not”)

    replace grade_A = 0 if overallgrade != "A" & overallgrade != ""
  9. missing option with tab: include missing values in frequency table

    tab overallgrade grade_A, missing
  10. gen() option with tab: create binary variables indicating each value from a frequency table

    tab overallgrade, gen(grade_)
  11. save: save the current dataset

    save "nycschools_modified.dta", replace