Statistics for management, stata commands, data management, descriptives, graphics, confidence Intervals, hypothesis testing, regression, operators for categorical variables, logistic regression, operators
version 14: specify Stata version clear all: clear working directory
cd "directory path": change working directory capture log close: close log file if one is already open log using filename, replace: open a new log file
log off: temporarily stop storing log on: start again
log close: close the log file
[...] Logistic regression logit depvar indepvars ( fits logistic regression margins, at(variable(s) = value(s)) ( computes predicted probabilities for given values of the independent variable(s) margins, dydx(variable) atmeans( computes the effects of the independent variable on the probability of success holding all variables at their averages margins, dydx(variable) at(variable(s) = value(s))( computes the effects of the independent variable on the probability of success for given values of the independent variable(s) X. [...]
[...] Statistics for Management – Stata Commands Statistics for Management Stata Commands I. General version 14 ( specify Stata version clear all ( clear working directory cd "directory path" ( change working directory capture log close ( close log file if one is already open log using filename, replace ( open a new log file log off ( temporarily stop storing log on ( start again log close ( close the log file II. Data management use filename, clear ( open Stata dataset save filename, replace ( create/save Stata dataset import excel file_name.xls firstrow clear sheet(“sheetname”)] ( import Excel files tostring varname, generate(newvarname) ( convert numeric variables to string variables destring varname, generate(newvarname) ( convert string variables to numeric variables sort varname1 [varname2] ( sort the obs in the dataset according to values of the variable(s) in range ( restrict a Stata command to obs that occupy a specific position within the dataset if expression ( restrict a Stata command to observations that satisfy a specific condition drop if expression ( remove one or more observation from the dataset drop in range ( remove one or more observation from the dataset keep if expression ( specify which observations to keep keep in range ( specify which observations to keep drop varlist ( remove one or more variables from a dataset keep varlist ( specify which variables to keep in the dataset count if expression ( count observations satisfying specified conditions label variable var_name “label” ( add label to variable label define mapName value1 “label1” value2 “label2” ( define a value label that contains the values and their meaning label value variable mapName ( attach the value label to the variable label list ( list of all value labels (and their content) that has been defined (in the session) label drop mapName ( remove value labels from memory rename nome_old nome_new ( rename variables generate newvar=exp ( generate a new variable replace oldvar=exp ( change the contents of an existing variable generate newdummy = (expression) ( generate a dummy variable recode varname rule1 [rule2] . [...]
[...] Descriptives describe [varlist]: decribe data list [varlist] list values of variables codebook [varlist]: decribe data contents tabulate varname miss]: one-way frequency table tabulate varname1 varname2 row col]: two-way frequency table summarize [varlist] detail]: compute descriptive statistics bysort varlist: Stata_command ( repeat a Stata command for all categories of the variables specified after by IV. Graphics graph bar, over(varname) [title("Title") by(groupvar)] ( built bar chart graph pie, over(varname) [title("Title") by(groupvar)] ( built pie chart hist varname[, title("Title") by(groupvar)] ( built histogram graph box varname[, title("title") by(groupvar)] ( built box-plot scatter varnames[, options] ( built scatter plot scatter varnames lfit varnames[, options] ( built scatter plot with fitted regression line qnorm varname ( built quantile plot V. [...]
[...] Confidence Intervals ci means varlist ( confidence interval for the mean VI. Hypothesis testing ttest varname = mizero ( one-sample t-test ttest varname1 = varname2 ( two-sample t-test for dependent (paired) samples ttest varname, by(groupvar) [unequal] ( two-sample t-test for independent samples sdtest varname, by(groupvar) ( F-test for comparing variances swilk varname ( test for normality pwcorr varlist[, sig] ( Pearson correlation (with significance test) anova varname groupvar ( Analysis of variance pwmean varname, over(groupvar) mcompare(tukey) effects ( pairwise comparisons after anova predict newvar, resid ( create variable with residuals VII. [...]
[...] Operators for categorical (factor) variables c. unary operator that specifies to treat the variable as continuous # binary operator to specify interactions binary operator to specify factorial interaction (main effects + all interactions) i. unary operator to specify categorical variables (it creates dummies) ( to be used if you have dummy not coded 0/1 IX. [...]
APA Style reference
For your bibliographyOnline reading
with our online readerContent validated
by our reading committee