clear all: empty out not just the current dataset but also other things stored in Stata’s memory
clear all
bys: repeat a command for different subsets of the data
bys schooltype: sum combined_score, detail
over() option: for many graphs, allows for grouping by a qualitative variable
graph box combined_score, over(schooltype)
encode: create a numeric version of a string variable
encode overallgrade, gen(grade_factor)
replace: change (some) values for a variable
replace grade_A = 1 if overallgrade == "A"
if: impose a restriction on a command (e.g., only apply to certain observations)
replace grade_A = 1 if overallgrade == "A"
==: check whether two things are equal
replace grade_A = 1 if overallgrade == "A"
!=: means “not equal” (the exclamation point means “not”)
replace grade_A = 0 if overallgrade != "A" & overallgrade != ""
missing option with tab: include missing values in frequency table
tab overallgrade grade_A, missing
gen() option with tab: create binary variables indicating each value from a frequency table
tab overallgrade, gen(grade_)
save: save the current dataset
save "nycschools_modified.dta", replace