Show Menu
Cheatography

STATA_101 Cheat Sheet by

StatClinix STATA couorse cheatsheet.

Basic Commands

cd
Change Working Directory
cd "­pat­h/l­oca­tio­n/h­ere­"
browse
Open Spread­sheet of Data (browse only)
browse
edit
Open Spread­sheet of Data (browse + edit)
edit
list
Print data to Stata Console
list variable_1 variable_2 variable_3
help
Open Help page for commands
help comman­d_name
in
Selecting by Observ­ation Number
list variable_1 in 1/5
if
Selecting Observ­ation by condition
list var1 if var2<50

Basic Operators

+
Add (Numbers) Combine (Strings)
-
Subtra­ction
*
Multip­lic­ation
/
Divide
^
Raise to a power
&
and
Operator
|
or
Operator
! or ~
not
Operator
=
Assigns a value to a variable
==
Compare whether two thing is equal
!=
Not Equal
<
Less Than
<=
Less than or equal to
>
Greater than
>=
Greater than or equal
 

Importing and Exporting Data

use
load Stata dataset
use "­dat­a/f­ile­/lo­cat­ion­"
sysuse
Open System Data files
"­sysuse data_n­ame­"
import excel
Import Excel Data, using my seet1 and first row as variable name
import excel using "­pat­h/t­o/f­ile­", sheet(­“my­she­et") firstrow
import delimited
Import tab or comma delimited Data, using my seet1 and first row as variable.
import delimited using "­C:­\pat­h\m­yfi­le.c­sv­", clear
import spss
Import SPSS Data
import spss "­you­rSP­SSf­ile.sa­v"
clear
clear dataset from memory
sysuse auto, clear
save
save Stata dataset
save auto, replace
replace
overwrite an existing file with the same name
save auto, replace

Exploring Data

codebook
inspect variable values
codebook variable1 variable2
summarize
summarize distri­bution
summarize variable1 variable2
tabulate
tabulate freque­ncies
tabulate variable1 variable2

Data Visual­ization

histogram
Creates Histogram
histogram variable1
graph box
Creates Boxplots
graph variable1 variable2
scatter
Creates Scatter plot
scatter variable1 variable2
graph bar
Creates Bar Plot
graph bar (count), over(v­ari­able)
twoway
Create multi-­layered plots
twoway (scatter var1 var2) (lowess var1 var2)
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Sublime Text 3 - Windows Cheat Sheet