SEHS2323 Statistical
Data Analysis
L07 - Structuring Data and Confidence Intervals
1
Agenda
Merging Confidence
data Intervals
2
Merging data
3
Merging Data
• . SAS reads the descriptor information of each data set that is named
in the MERGE statement.
• Then, SAS creates a program data vector that contains all the
variables from all data sets as well as variables created by the DATA
step
4
Merging Data
• SAS reads the first observation from each data set into the program
data vector, reading the data sets in the order in which they appear in
the MERGE statement.
• If two data sets contain the same variables, the values from the
second data set replace the values from the first data set.
• After reading the first observation from the last data set and
executing any other statements in the DATA step, SAS writes the
contents of the program data vector to the new data set.
• Only those variables that are created or assigned values during the
DATA step are set to missing.
5
6
7
8
Merging data
9
Merging Data – Full Join
10
11
12
13
Merging data – Left Join
14
Merging data – Left Join
15
16
17
18
19
Merging data – Far Left Join
20
Merging data – Far Left Join
21
22
23
Merging data – Far Right Join
24
25
26
27
Merging data using Inner Join
28
Merging data – Inner Join
29
Merging data – Inner Join
30
31
32
33
34
35
Confidence Intervals
36
Confidence Intervals
• A confidence interval (CI) is a fundamental concept in statistics used
to estimate an unknown population parameter, such as a mean or
proportion, based on sample data.
• Instead of providing a single point estimate, a confidence interval
gives a range of plausible values within which the true parameter is
expected to lie, along with a specified confidence level—commonly
95% or 99%.
37
How Students Use Confidence Intervals to
Understand Statistics
• Visualizing Estimate Precision:
• Confidence intervals help students see that point estimates are not exact but have a range of uncertainty,
fostering a deeper understanding of variability and reliability in data.
• Interpreting Statistical Results:
• By examining whether confidence intervals overlap or include certain values (like zero in difference tests),
students learn to interpret the significance and practical importance of results beyond just p-values.
• Connecting Theory and Practice:
• Calculating and interpreting confidence intervals reinforces concepts like sampling distribution, standard
error, and the role of sample size, bridging theoretical statistics and real-world data analysis.
• Critical Thinking:
• Understanding that confidence intervals reflect the method’s long-run performance encourages students to
think critically about the reliability of conclusions drawn from data.
38
Confidence Intervals
• A Confidence Interval is a range of values we are fairly sure our true
value lies in.
39
Confidence Intervals
40
Confidence Intervals
41
42
Confidence Intervals
43
Confidence Intervals
44
Confidence
Intervals
45
Confidence Intervals
46
Confidence Intervals
47
Confidence Intervals
48
Confidence Intervals
49
Confidence Intervals
50
Confidence Intervals
51
Confidence Intervals
52
Confidence Intervals
• Use CLM or both LCLM and UCLM to compute a two-sided confidence
limit for the mean. Use only LCLM or UCLM, to compute a one-sided
confidence limit.
53
Example 1
54
Confidence Intervals
• PROC means data= dataset
• Mean
• Std
• N
• Lclm
• Uclm
• Alpha = .05
• Var
• By
55
Example 2
56
Example 2
57
Example 3
58
Example 3
• PROC SORT
• By
• Output
• Out
• N=
• MEAN=
• STDERR=
• LCLM=
• UCLM=
59
60
61
62
63
64
65