* this exercise uses the "census" data set available via https://www.openintro.org/stat/extras.php * clear the data clear * describe the data (variable name, storage type, etc.) des * summarize the data (variable, observations, mean, standard deviation, min, max) sum * look at data in read-only format browse * look at data with the option to make changes edit * drop variables drop censusyear * rename variables rename totalfamilyincome finc rename totalpersonalincome pinc rename racegeneral race rename maritalstatus marital rename statefipscode state * destring, replacing "NA" with . destring finc, replace ignore("NA") * mean of a variable, including confidence interval around mean mean pinc * generate a new binary variable based on existing string variable gen male = 1 if sex == "Male" replace male = 0 if male == . * histogram hist pinc * box and whiskers graph graph box pinc * pie charts gen one = 1 graph pie one, over(sex) graph pie one, over(race) * scatter plot scatter pinc age * scatter plot with linear fit scatter pincr age || lfit pincr age * scatter plot with quadratic fit scatter pincr age || qfit pincr age * regression of personal income on age regress pinc age * regression of personal income on age and age squared gen age2 = age^2 reg pinc age age2 * regression of personal income on age, age squared, and gender reg pinc age age2 male