-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimple Stata Analysis.do
More file actions
42 lines (33 loc) · 1.07 KB
/
Simple Stata Analysis.do
File metadata and controls
42 lines (33 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
sysuse "bpwide"
*Show the data;
**>>>ST:Verbatim(Label="Show Data", Frequency="Always")
list if _n<=10
**<<<
*Number of observations;
count
**>>>ST:Value(Label="N obs", Frequency="Always", Type="Numeric", Decimals=0, Thousands=False)
display r(N)
**<<<
*mean of bp before
summarize bp_before
**>>>ST:Value(Label="BP before mean", Frequency="Always", Type="Numeric", Decimals=1, Thousands=False)
display r(mean)
**<<<
**>>>ST:Value(Label="BP before sd", Frequency="Always", Type="Numeric", Decimals=1, Thousands=False)
display r(sd)
**<<<
**>>>ST:Table(Label="Age Groups", Frequency="Always", Type="Default")
*Table of Age Groups
tabulate agegrp, matcell(x)
matrix list x
**<<<
local dir `c(pwd)'
*Graph of BP before by agegrp
**>>>ST:Figure(Label="BP by Age Group", Frequency="Always")
graph box bp_before, over(agegrp) title("Blood Pressure by Age Group")
graph export "`c(pwd)'\BloodPressurebyAgeGroup.pdf", as(pdf) replace
**<<<
*Model of relationship between bloodpressure anf age group
**>>>ST:Verbatim(Label="Univariate Model", Frequency="Always")
xi: regress bp_before i.agegrp
**<<<