Cheatography
https://cheatography.com
StatClinix STATA couorse cheatsheet.
Basic Commands
cd |
Change Working Directory |
cd "path/location/here" |
browse |
Open Spreadsheet of Data (browse only) |
browse |
edit |
Open Spreadsheet 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 command_name |
in |
Selecting by Observation Number |
list variable_1 in 1/5 |
if |
Selecting Observation by condition |
list var1 if var2<50 |
Basic Operators
+ |
Add (Numbers) Combine (Strings) |
- |
Subtraction |
* |
Multiplication |
/ |
Divide |
^ |
Raise to a power |
& |
|
| |
|
! or ~ |
|
= |
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 "data/file/location" |
sysuse |
Open System Data files |
"sysuse data_name" |
import excel |
Import Excel Data, using my seet1 and first row as variable name |
import excel using "path/to/file", sheet(“mysheet") firstrow |
import delimited |
Import tab or comma delimited Data, using my seet1 and first row as variable. |
import delimited using "C:\path\myfile.csv", clear |
import spss |
Import SPSS Data |
import spss "yourSPSSfile.sav" |
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 distribution |
summarize variable1 variable2 |
tabulate |
tabulate frequencies |
tabulate variable1 variable2 |
Data Visualization
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(variable) |
twoway |
Create multi-layered plots |
twoway (scatter var1 var2) (lowess var1 var2) |
|
Created By
https://rana2hin.me
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets