* cda02a-review2.do - CDA Lab Guide 2: Linear Regression - 23May2007 capture log close set more off estimates clear * 1 open the log log using cda02a-review2.log, replace text version 9.2 set scheme s2mono * 2 load the data use sci-review, clear * 3 select variables and examine the data keep pubsum faculty enrol phd tab1 faculty enrol phd, m drop if pubsum>=. | faculty>=. | enrol>=. | phd>=. * another way to drop missing cases is to use mark/markout commands * let's reload the dataset and try it this way use sci-review, clear keep pubsum faculty enrol phd mark nomiss //creates a new variable called nomiss equal to 1 for all cases markout nomiss pubsum faculty enrol phd //marks-out cases missing on any of the variables by recoding to 0 tab nomiss //there are 36 cases with missing values on one or more of the vars //this matches the number above keep if nomiss==1 //keep only nonmissing cases drop nomiss //nolonger need the "flag" variable * 4 regression regress pubsum faculty enrol phd * 5 standardized coefficients listcoef, help * 6 close log file log close exit