Sei sulla pagina 1di 3

Basic Stata Commands To access help files for specific commands help <command name> (e.g.

help regress) To change directory: cd directory name To open a file: use filename, clear To save a file: save filename, replace To edit (or browse) a dataset: edit (or ed) To edit (or browse) a subset of variables: edit <variable names> To edit a subset of the data (e.g. with a female dummy for women only) edit if female == 1 To edit a subset of the data when the relevant variable is a string (e.g. for China only in a crosscountry dataset) edit if country == China To install a program (e.g. to install a program to put results into a table) ssc install outreg2 To uninstall a program ssc uninstall outreg2 To summarize a dataset (or variables from a dataset) summarize Summarize <variable names> To obtain more descriptive statistics summarize, detail summarize <variable names>, detail

To run a simple OLS regression regress <dependent variable> <independent variables> To estimate heteroscedasticity consistent standard errors regress <dependent variable> <independent variables>, robust To drop the constant regress <dependent variable> <independent variables>, noc To perform the Breusch-Pagan Test of Heteroscedasticity estat hettest To perform the Ramsey RESET test estat ovtest To perform the Heckman Two-Step estimator Heckman <dependent variable> <independent variables>, select(<variables on which selection takes place>) To put results into a table (basic table) i. Initial column outreg2 using <filename>, replace word (or excel) addstat(F-test, e(F)) ii. To add a second (or third or fourth column) outreg2 using <filename>, replace word (or excel) addstat(F-test, e(F)) iii. To drop some variables from the table outreg2 using <filename>, replace drop(<variable names>) word (or excel) addstat(F-test, e(F)) To estimate the Blinder-Oaxaca decomposition Firstly you must install the program using ssc install oaxaca oaxaca <dependent variable> <independent variables>,by(<variable that splits the data, e.g. female>) To perform an instrumental variables (2SLS) regression ivregress 2sls <dependent variable> <independent variables> (<endogenous variable(s)> = <excluded exogenous instruments>) To construct robust standard errors with IV ivregress 2sls <dependent variable> <independent variables> (<endogenous variable(s)> = <excluded exogenous instruments>), vce(robust)

To estimates a model using 3SLS reg3 (<dependent variable_1> <explanatory variables_1>) (<dependent variable_2> <explanatory variables_2>) (<dependent variable_3> <explanatory variables_3>)... To estimate a Probit model probit <dependent variable> <independent variables>, robust To estimate a Logit model logit <dependent variable> <independent variables>, robust To calculate average partial effects (APE) margins, dydx(<variable names>) To calculate partial effects at the average (PEA) margins, dydx(<variable names>) atmeans

Potrebbero piacerti anche