B) Stata Interface (With Data and Commands, Windows) : End: The Introduction of Data Has Finished
B) Stata Interface (With Data and Commands, Windows) : End: The Introduction of Data Has Finished
windows)
Command
clear
input x
1
2
3
end
summarize x
Explanation
cleans the previous data set without saving
the data
creates a new numeric variable called x
These are 3 values for x
end: the introduction of data has finished
Descriptive statistics for variable x (the
underlined text is enough to make the
command work)
Explanation
Supress the repeated presence of the word
more (it will annoy you by tirelessly
requesting that you may press the space bar
to continue)
Clears the previous data base
Do this only if you are using version 13 or
higher, to keep the routines (specially the
generation of random values) as they were
in version 12.
Creates 100 empty rows
Set a random seed: new data will be
randomly generated, but they will be the
same when you run again this sequence of
commands
Generates a new random variable called
speed with mean = 80 and standard
deviation=20 (approximately)
You have changed the values for the variable
speed
in row 1, speed=20
in row 2, speed=33
in row 100, speed=180
Descriptive statistics are requested
clear
version 12
set obs 100
set seed 333
generate speed=rnormal(80,20)
replace speed=20 in 1
replace speed=33 in 2
replace speed=180 in 100
summarize speed, detail
sex
0
0
1
0
1
1
0
0
1
1
1
0
0
1
1
0
0
1
1
1
1
0
0
0
0
n
50
40
10
8
25
20
5
4
0
0
0
0
0
0
0
0
650
860
690
892
675
880
695
896
8. Histograms: hist
clear
version 12
set obs 500
set seed 1234
gen x=rnormal(100,10)
weight_chg
-1
0
0
.5
2.5
2
3
clear
input ///
str15 country Chocolate
Nobel
China
0.700
0.060
Brazil
2.900
0.050
Spain
3.600
1.701
Poland
3.600
3.124
Australia
4.500
5.451
Canada
3.900
6.122
Netherlands
4.500
11.356
USA
5.300
10.770
Ireland
8.800
12.706
Germany
11.600
12.668
UK
9.700
18.875
Switzerland11.900
31.544
Sweden
6.480
31.855
end
///
n
1
5
4
7
10
12
4
clear
input ///
lowfatdai averageSBP
1
140
2
132
3
128
4
122
5
110
end
clear
input Q4 RR low upper
1 1 1
1
20.8 0.4
1.6
30.6 0.4
0.9
40.5 0.3
0.833
end
22. Graphics to
assess
clear
version 12
se obs 999
se seed 1234
6
n
10
20
90
80
n
10
20
90
80
n
5
7
1
0
end
expand n
0
0
1
11
0
1
0
1
cancer
0
0
1
1
n
1591
1582
9
18
0
0
1
1
1555
1510
45
90
version 12
set seed 1234
g e=rnormal(0,2)
g bmi_2yr=bmi+0.25+e
///
group
1
1
1
1
1
4
8
8
8
2
2
2
2
8
8
10
12
12
3
3
3
3
3
end
weight_chg
-1
0
0
.5
2.5
2
3
ses
1
1
1
1
2
2
1
4
2
2
3
4
4
3
smk
1
1
1
1
0
1
1
1
0
2
0
2
0
2
age
68
65
65
63
71
71
58
53
49
52
48
55
52
45
ses
1
1
1
1
2
2
1
4
2
2
3
4
4
smk
1
1
1
1
0
1
1
1
0
2
0
2
0
age
68
65
65
63
71
71
58
53
49
52
48
55
52
10
-8
end
45
clear
input ///
id time weight diet
1
1
76
1
1
2
65
1
1
3
63
1
2
2
2
1
2
3
82
70
68
1
1
1
3
3
3
1
2
3
80
78
70
1
1
1
4
4
4
1
2
3
83
83
84
2
2
2
5
5
5
1
2
3
79
80
79
2
2
2
6
6
6
end
1
2
3
84
84
84
2
2
2
age
68
65
66
63
45
38
43
35
69
52
48
35
72
55
weight2 weight3
65
63
70
68
78
70
11
diet
1
1
1
4
5
6
end
83
79
84
clear
input ///
subject
1
1
1
1
2
2
2
2
end
83
80
84
SBP
120
125
121
116
118
122
122
124
84
79
84
2
2
2
hour
9
12
18
24
9
12
18
24
weight2 weight3
65
63
70
68
78
70
83
84
80
79
84
84
diet
1
1
1
2
2
2
n
50
10
40
20
12
clear
sysuse cancer
clear
input ///
FVL
OC
1
1
1
1
0
0
0
0
end
expand n
DVT
1
0
1
0
1
0
1
0
CHD
1
1
0
0
1
1
0
0
n
400
120
7600
1880
30
84
2970
6916
1
1
0
0
61
6
710
940
1
1
0
0
30
8
9700
9920
13
14