mcfarland, stata1.txt Selected STATA Commands * Stata online help lookup frequencies (topic) help tabulate (stata command) (Note: Type space, enter, or q in response to --more-- prompt) * Session Preliminaries dir e:\S210a\ (where e: is the Zip drive) log using e:yymmddss.log (suggested log file name for session ss on day dd, month mm, year yy) * Load a Stata-format dataset into memory (if you already have the data that way) use e:\hamilton\canada2.dta * Load selected variables of a Stata-format dataset into memory use educ income91 age using e:\S210a\gss94.dta * Load a raw ascii text file dataset into memory, and save it in Stata format infile rincome educ sex tithing year using e:\S210a\icpsr1.txt save e:\S210a\icpsr1.dta (Note: Tithing was 1987-89 only, not in gss94.dta.) * Type a new (small) dataset into stata edit save e:\S210a\wstates.dta * Examine the dataset in memory describe summarize * Examine a particular variable, compare frequencies with codebook tabulate rincom91 * Recode missing data replace rincom91 = . if rincom91 == 0 replace rincom91 = . if rincom91 > 21 (Beware, rincom91 codes 0 and 22 have unexpected meanings.) * Examine a particular variable whose codebook frequencies are grouped tabulate age generate age_temp = int(age/10) tabulate age_temp tabulate age_temp , missing drop age_temp (Note: Arithmetic on . yields . for answer.) or for unequal intervals: generate tith_temp = 1 replace tith_temp = 2 if tithing > 250 replace tith_temp = 3 if tithing > 500 replace tith_temp = 4 if tithing > 1000 replace tith_temp = 5 if tithing > 9999 replace tith_temp = . if tithing > 99994 tabulate tith_temp , missing drop tith_temp (Beware: comparison > treats . as a very large number.) * Examine shape of a variable's distribution, via frequency table and histogram. Calculate summary statistics and assess their appropriateness. tabulate partners graph affrmact graph tvhours summarize partners affrmact tvhours * End session save log close exit, clear