***This Do File Accompanies the 2008 PRISM Brownbag: Intro to Stata***
**Presented by Dino Christenson and Scott Powell of Ohio State University**

*Basic Math and Statistics
di 20*1.5-17
di Binomial(10,5,.5)
di normal(1.96)
help density functions

****Loading the Data Set
**This should call the proper directory of your data 
*You will need to adjust this accordingly
use "C:\Users\name.#\Desktop\NES04_V_StataIntro08.dta", clear

*Creating New Variables
gen left = 1 if ideology <0
replace left = 0 if ideology >=0
recode marr (0=1) (1=0), gen(single)

*Matrices
matrix input mat1 = (1\2\3)
matrix input mat2 = (1,2,3)
matrix mat3 = mat1*mat2
matrix list mat3

*Descriptives: Tabulation
tab ideology
tab left
tab marr
tab single

*Descriptives: Summary
sum
sum ideology

*Descriptives: Cross-tabulation and sorting
tab left marr
sort left
by left: sum educ

*Data Types
describe

***Help in Stata
help contents
help tabulate
help tabulate oneway
search clarify, all

***Graphing in Stata
*Scatterplot
scatter reptherm age

*Scatterplot - sort by another variable
scatter reptherm age, by(vote)

*Histogram / Bar Chart
hist ideology, discrete width(1)

 
