/* --------------------------------------- Administrative commands ------------------------------------------*/ capture log close /* Opens log file */ log using anols, replace /* Creates log file anols */ set more off /* Load data set */ use states, clear /* Loads STATA format states.dta. The clear option clears the memory before loading the data */ /* Regress */ regress csat expense percent high college NCdummy /* Makes a regression of csat on expense percent high college NCdummy */ /* Reports the results stored by STATA from the regression */ ereturn list /* Display variance covariance matrix */ matrix list e(V) /* Perform a t-test on high school graduates */ matrix define V = e(V) /* Stores variance-cov matrix in matrix V */ scalar define thigh = _b[high]/sqrt(V[3,3]) /* Computes the t-stat */ display "the t-test for high school is:" scalar list thigh /* Displays the results in thigh */ /* Perform a t-test on NC state */ scalar define tNC = _b[NCdummy]/sqrt(V[5,5]) /* Computes the t-stat */ display "the t-test for NC state is:" scalar list tNC /* Displays the results in tNC */ /* --------------------------------------- Close log file ------------------------------------------*/ log close exit