SAS Computing

These 39 SAS programs accompanied the third edition. Choose a chapter and open a table to read or download its program. The table numbers follow the third edition. Updates for the fourth edition will follow.

Before running a program, save the SAS data files on your computer and change the folder path in the LIBNAME statement to their location. The 151 fourth-edition datasets are also available in SAS transport format (.xpt).

Chapter 3. One-way between-subjects designs

Table 1 · A one-sample t test for IQ scores

Download SAS program · Link to this example · Archived copy

*
chapter_3_table_1

The data set analyzed to replicate Chapter 3 Table 1 consists of IQ 
(WISC-R) measurements on six hyperactive children. The question of 
interest is: "are hyperactive children in the school district brighter 
than the average student?" The mean IQ among the students is known to 
be 98. Thus, the null hypothesis in this situation is that the 
population mean for the hyperactive students is also 98.

To answer such a question we perform a one sample t-test specifying the null 
hypothesis (H0) as 98. Because a t-value squared with X degrees of freedom is equivalent
to an F value with one numerator and X denominator degrees of freedom, our results 
are equivalent to those reported in the book. Recall that the observed F-value 
(with 1 and 5 degrees of freedom) in the book is 9, whereas our t-value (with 5 
degrees of freedom) is 3.
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c3t1;
       SET md.chapter_3_table_1;
PROC TTEST H0=98;
RUN;

Table 3 · Comparing mood ratings with one-way ANOVA

Download SAS program · Link to this example · Archived copy

*
chapter_3_table_3

The following data set consists of three groups of 10 participants who were randomly 
assigned to one mood-induced condition. After viewing a video that was supposed to 
induce a certain mood state, the participants rated their mood state on several 
scales. The hypothesis of interest is whether the population group mean on Global 
Affect Rating differed among the groups. 

Here we run a one-way ANOVA on the Mood-Induction data and obtain the results
given in Table 3.4.
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     DATA c3t3;
       SET md.chapter_3_table_3;
PROC GLM DATA=c3t3;
CLASS cond;
MODEL mood = cond;
RUN;

Tables 7 and 9 · Descriptive statistics for drinking outcomes across five therapy groups

Download SAS program · Link to this example · Archived copy

*
chapter_3_table_7_and_9

The data set analyzed to replicate Chapter 3 Tables 7 and 9 consist
of the number of drinks per week at a nine month follow-up for 
participants in five different therapy groups. The purpose of this 
data set is to assess the likelihood of the assumptions of the 
parametric statistical tests (in this case the assumptions of normality 
and homogeneity of variance). This data set is also of interest in 
order to explore potential transformations (e.g., the log 
transformation), such that the parametric assumptions may be more 
satisfied. 

Here we use PROC MEANS in order to replicate Tables 3.7 and 3.9. Note 
that the medianfor 'T1 CRA-D' (i.e., Group 1 in the Output) should be 
10.98, not 11.89 as is listed in Table 3.9. In addition, the kurtosis 
for 'T2 CRA-D' (i.e., Group 4 in the Output) in the book should be 
2.78, not 1.06 as is listed in Table 3.9.
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     DATA c3t79;
       SET md.chapter_3_table_7_and_9_raw_data;
PROC MEANS DATA=c3t79 MEAN N MEDIAN MIN MAX STD SKEWNESS KURTOSIS;
CLASS group;
RUN;

Back to chapter index

Chapter 4. Individual comparisons of means

Table 1 · Comparisons of blood pressure across four treatments

Download SAS program · Link to this example · Archived copy

* 
Chapter 4, Table 1

The hypothetical example shown in Table 4.1 consists of systolic blood pressure scores for 
20 participants in four treatment groups for hypertension. The participants were randomly 
assigned to the four treatment groups of interest: drug therapy, biofeedback, diet, and 
combination. Note that for this example, there are not equal sample sizes in each group; 

LIBNAME md 'd:\data files by type\sas data files\tables';
DATA c4table1; 
SET md.chapter_4_table_1;

* Our first hypothesis of interest is whether the drug therapy and feedback groups differ in 
their effectiveness in treating hypertension. To test this hypothesis, we perform a simple 
pairwise comparison for the drug therapy and feedback groups. An illustrative example of the 
calculations for this analysis is shown in Table 4.2, while the SPSS output and contrast 
coefficients for this analysis are shown in Table 4.4. The following SAS syntax is used to 
obtain the pairwise comparison of means between the drug therapy and the biofeedback groups 
in Chapter 4, Table 1;

PROC GLM; 
CLASS cond; 
MODEL bloodpr = cond;
CONTRAST 'Drug Therapy vs. Biofeedback' cond 1 -1 0 0;
RUN;

* Our second hypothesis of interest is whether the average of the drug therapy, biofeedback, 
and diet groups differs from the combination group in effectiveness in treating hypertension. 
Using the data from Table 4.1, we test this hypothesis by performing a complex comparison of 
means by comparing the average of the means of the drug therapy, biofeedback, and diet groups 
to the mean of the combination group. An illustrative example of the calculations for this 
analysis is shown in Table 4.3, while the SPSS output and contrast coefficients for this 
analysis are shown in Table 4.4. The following SAS syntax is used to obtain the complex 
comparison of means between the average of the drug therapy, biofeedback, and diet groups and 
the combination group in Chapter 4, Table 1;

PROC GLM; 
CLASS cond; 
MODEL bloodpr = cond;
CONTRAST 'Drug Ther, Biofeed, and Diet vs. Combination' cond 1 1 1 -3;
RUN;

 

Back to chapter index

Chapter 5. Multiple comparisons

Table 4 · Planned contrasts among four treatment means

Download SAS program · Link to this example · Archived copy

*
chapter_5_table_4

The following data consists of blood pressure measurements for six 
individuals randomly assigned to one of four groups. Our purpose 
here is to perform four planed contrasts in order to discern if 
group differences exist for the chosen contrasts of interests. 

At the time of this writing, SAS does not seem to be able to compute 
the appropriate critical values for the Bonferroni procedure given 
the contrasts specified, nor is it able to perform contrasts when 
homogeneity of variance is not assumed. As is stated on page 207 
of the text, "the best one can do . . . is to obtain intermediate 
values that can then be used as input to appropriate formulas" for
hand calculations.
;


LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c5t4;
       SET md.chapter_5_table_4;
PROC GLM DATA=c5t4;
CLASS group;
MODEL sbp = group;
CONTRAST 'Assuming Equal Variances: Group 1 vs. 2'
group 1 -1 0 0;
CONTRAST 'Assuming Equal Variances: Group 1 vs. 3'
group 1 0 -1 0;
CONTRAST 'Assuming Equal Variances: Group 2 vs. 3'
group 0 1 -1 0;
CONTRAST 'Assuming Equal Variances: Mean of Group 1, 2, and 3 vs. 4 '
group 1 1 1 -3;
RUN;

Back to chapter index

Chapter 6. Trend analysis

Table 1 · Trends in recall across four study times

Download SAS program · Link to this example · Archived copy

*
chapter_6_table_1

The data in Table 6.1 consist of recall scores for 24 children who have been randomly 
assigned to one of four experimental conditions where there are 6 children in each 
condition. The experimental conditions of interest are 1, 2, 3, and 4 minutes where the
number of minutes is the amount of time the child is allotted to study a list of words 
before attempting to recall the words. The dependent variable (i.e., the recall scores) are
the number of words the child is able to recall after a brief interference task;  

LIBNAME md 'd:\data files by type\sas data files\tables';
DATA c6t1; 
SET md.chapter_6_table_1;

*The first hypothesis of interest is whether the number of words recalled is linearly 
related to the number of minutes spent studying. We test this hypothesis by determining if 
the linear trend is statistically significant. Pages 252 and 253 are associated with this 
test. The following SAS syntax is used to obtain the test of the linear trend along with the
estimate of the slope parameter from the data in Chapter 6, Table 1. Keep in mind that in 
order to obtain the correct slope estimate, one must divide by the sum of the squared 
weights as shown page 248. This is why weights of -.3, -.1, .1, and .3 are used to estimate 
the linear trend;

PROC GLM; 
CLASS minutes; 
MODEL recall = minutes;
CONTRAST 'linear' minutes -1.5 -.5 .5 1.5;
ESTIMATE 'linear' minutes -0.3 -0.1 0.1 0.3;
RUN;

*Next, we are interested in determining if there is any nonlinearity (i.e., deviation from
linearity) present in the relationship between the number of words recalled and the amount 
of time spent studying. Page 257 demonstrates the results associated with this statistical 
test. The following SAS syntax is used to obtain the test of nonlinearity from the data in 
Chapter 6, Table 1;

PROC GLM; 
CLASS minutes; 
MODEL recall = minutes;
CONTRAST 'non-linear' minutes 1 -1 -1 1, minutes -1 3 -3 1;
RUN;

*Finally, we are interested in determining if the quadratic or cubic components of the 
relationship between the number of words recalled and the amount of time spent studying are 
statistically significant. It is important to note that the results for the linear, 
deviation from linear, quadratic, and cubic trends replicated by the procedures shown here 
are illustrated in Table 6.3. The following SAS syntax is used to obtain the test of the 
quadratic and cubic trends from the data in Chapter 6, Table 1;

PROC GLM; 
CLASS minutes; 
MODEL recall = minutes;
CONTRAST 'quadratic' minutes 1 -1 -1 1; 
CONTRAST 'cubic' minutes -1 3 -3 1;
RUN;





 

Back to chapter index

Chapter 7. Two-way factorial designs

Table 1 · A one-way analysis of four drug and biofeedback combinations

Download SAS program · Link to this example · Archived copy

*
chapter_7_table_1

The following data consists of blood pressure measurements taken after the end of 
treatment for five individuals that were randomly assigned to one of four groups.
The initial question of interest is whether there is a significant difference 
between any of the group means, that is, are all of the population group means 
equal or is there a difference somewhere.

As before, we can perform a one-way ANOVA via the GLM procedure.

Note that this analysis does not take into consideration the interaction between 
biofeedback and drug. For pedagogical reasons this data set is analyzed as though 
it were a one-way design with four groups. As is explained in the text, the concept 
of an interaction is important and should not be overlooked. Table 7.7 shows the 
results of the data from Table 7.5, where the interaction of biofeedback and 
drug is explicitly taken into consideration. 
;


LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c7t1;
       SET md.chapter_7_table_1;
PROC GLM DATA=c7t1;
CLASS group;
MODEL score = group;
RUN;
Table 5 · Drug, biofeedback, and their interaction

Download SAS program · Link to this example · Archived copy

*
chapter_7_table_5

The following data is a generalization of the blood pressure data given in Table 7.1
(as there are now three, rather than two, levels of the drug factor). In addition to 
assessing the likelihood of there being a biofeedback or a drug main effect, the 
interaction is explicitly taken into consideration. The results replicate those 
given in Table 7.7.
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c7t5;
       SET md.chapter_7_table_5;
PROC GLM DATA=c7t5;
CLASS drug feedback;
MODEL score = drug feedback drug*feedback;
RUN;
Table 9 · Simple main effects after an interaction

Download SAS program · Link to this example · Archived copy

*
chapter_7_table_9

The following data is a generalization of the blood pressure data 
given in Table 7.5 (which itself was a generalization of the data 
given in Table 7.1). After the interaction is found to be significant,
a common recommendation is to examine simple main effects. Recall 
that a simple main effect is the main effect of one factor given a 
fixed level of another factor. In this case interest is in determining 
if there are any differences in drugs (a) given biofeedback and (b) 
given no biofeedback. 

Note that the LSMEAN computes least squares means for the effects 
listed in the LSMEAN statement. In this case SLICE is listed. SLICE 
tests simple main effects by "slicing" the interaction by the specified
variable. The SLICE= option specifies the effects by which to divide 
interaction LSMEAN effects. This can produce what are known as tests 
of simple effects.  
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c7t9;
       SET md.chapter_7_table_9;
PROC GLM DATA=c7t9;
CLASS drug feedback;
MODEL score = drug feedback drug*feedback;
LSMEANS drug*feedback / SLICE=drug; 
RUN;
Table 11 · An interaction contrast for diagnosis and task

Download SAS program · Link to this example · Archived copy

*
chapter_7_table_11

The following data represents a two way factorial design where diagnosis
and task are fully crossed, each with three levels. Of interest for the 
results displayed in Table 7.12 is where the interaction contrast 
specified in Figures 7.3 and 7.4 is statistically significant. Namely 
the question pertains to whether the relationship of the mean of grammar
and classification versus recognition differs for those in the amnesic 
and Huntington's group.

The 'contrast' statement for the interaction (diagnose*task) effect 
essentially allows one to specify the necessary contrast coefficients 
as given in Figures 7.3 and 7.4. Note that the coefficients specified 
should be whole numbers.
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c7t11;
       SET md.chapter_7_table_11;
PROC GLM DATA=c7t11;
CLASS diagnose task;
MODEL y = diagnose task diagnose*task;
contrast 'Results for Table 7.12' diagnose*task 1 1 -2 -1 -1 2 0 0 0;
RUN;
Table 15 · Salary differences in a nonorthogonal factorial design

Download SAS program · Link to this example · Archived copy

*
chapter_7_table_15

The following hypothetical salary data represents a nonorthogonal 
two-by-two factorial design. The first factor (sex) is crossed with 
college (degree or no degree). The primary question of interest is 
whether or not there is sex discrimination in terms of salary.

As before, this factorial ANOVA is analyzed using the GLM procedure. 
However, unlike the factorial ANOVAs that we have previously seen, this
one has "/ SS3" on the model statement line. This option says to use the
Type III sums of squares. Changing "SS3" to "SS1," "SS2," or "SS4" will 
produce the type I, II, and IV sums of squares, respectively (multiple 
sums of squares can also be specified by placing them after the forward 
slash on the model statement line). Recall that the different types of 
sums of squares (less Type IV) are formally compared in Tables 7.19 
through 7.22. 

Note that for the Type I sums of squares the order an effect enters 
the model statement line matters. Listing "A" first on the model 
statement line, for example, will lead to "Type I sums of squares 
where 'A' is entered first."
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c7t15;
       SET md.chapter_7_table_15;
PROC GLM DATA=c7t15;
CLASS educ sex;
MODEL salary = sex educ sex*educ / SS3;
RUN;
Table 23 · Psychotherapy outcomes with blocking by depression severity

Download SAS program · Link to this example · Archived copy

*
chapter_7_table_23

The following data represent the relative effectiveness of three forms of 
psychotherapy for alleviating depression. Fifteen individuals were randomly 
assigned to one of three groups. After the fact, these individuals where 
placed into one of three categories based on the severity of their depression.
Thus, this data set represents a 3 by 3 nonorthogonal factorial design with post 
hoc blocking.

This analysis proceeds in the typical way for factorial designs. However, 
because the design is nonorthogonal, care must be taken to ensure the 
desired type of sums of squares is used. Here we have used three model
statements (in three different applications of the GLM procedure) to 
illustrate several types of sums of squares. Notice that for the Type I
sums of squares the order the effect is included on the model statement
line makes matters. 
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c7t23;
       SET md.chapter_7_table_23;
* Here we perform Type III and Type II sums of squares. Notice how you can
specify multiple types of sums of squares with only one model statement line.;
PROC GLM DATA=c7t23;
CLASS therapy severity;
MODEL score = therapy severity therapy*severity / SS3 SS2;
RUN;
* Here we use the Type I sums of squares and enter severity first.
We do this by placing it before therapy on the model statement line.;
PROC GLM DATA=c7t23;
CLASS therapy severity;
MODEL score = severity therapy severity*therapy / SS1;
RUN;
* Here we use the Type I sums of squares and enter therapy first.
We do this by placing it before severity on the model statement line.;
PROC GLM DATA=c7t23;
CLASS therapy severity;
MODEL score =  severity therapy therapy*severity / SS1;
RUN;

Back to chapter index

Chapter 8. Higher-order factorial designs

Table 12 · Drug, diet, and biofeedback in a three-way factorial design

Download SAS program · Link to this example · Archived copy

*
chapter_8_table_12

The data in Table 8.12 consist of blood pressure scores for 72 participants. Three 
categorical independent variables: the presence and absence of biofeedback (biofeed), 
drug X, Y, or Z (drug), and diet absent or present (diet) have been factorially combined to
form a 2 x 3 x 2 design where each person contributes one blood pressure score to one of 
the 12 different experimental conditions. For this example, there are 6 participants in each 
group; 

LIBNAME md 'd:\data files by type\sas data files\tables';
DATA c8t12; 
SET md.chapter_8_table_12;

* First, the omnibus tests of interest will be computed to determine if there are 
differences among the groups on the mean level of blood pressure. Table 8.14 illustrates 
the results replicated here. The following SAS syntax is used to obtain the omnibus tests 
for the data in Chapter 8, Table 12;

PROC GLM; 
CLASS biofeed drug diet; 
MODEL bp = biofeed|drug|diet;
RUN;

* The next analyses to be carried out are the simple interaction tests. Specifically we are
interested in testing the interaction between biofeedback and drug within the diet absent 
and diet present conditions. The result of the analyses we are replicating are in 
Table 8.16. The following SAS syntax is used to obtain the simple interaction tests for the
data in Chapter 8, Table 12;

PROC GLM; 
CLASS biofeed drug diet; 
MODEL bp = biofeed|drug|diet;
CONTRAST 'simple interaction test diet absent' biofeed*drug 1 -1 0 -1 1 0 biofeed*drug*diet 1 0 -1 0 0 0 -1 0 1, 
biofeed*drug 1 1 -2 -1 -1 2 biofeed*drug*diet 1 0 1 0 -2 0 -1 0 -1 0 2;
CONTRAST 'simple interaction test diet present' biofeed*drug 1 -1 0 -1 1 0 biofeed*drug*diet 0 1 0 -1 0 0 0 -1 0 1, 
biofeed*drug 1 1 -2 -1 -1 2 biofeed*drug*diet 0 1 0 1 0 -2 0 -1 0 -1 0 2;
RUN;

* One might also be interested in testing the simple, simple main effects within a 
particular condition of diet. Here we are interested in the simple, simple main effects of
both biofeedback and drug within the diet absent condition. The following syntax produces 
the results contained in Table 8.17 and also produces the corresponding confidence 
intervals illustrated in Table 8.21. Note that the confidence intervals can be multiplied 
by -1 to literally match the results obtained in the book. This is due to arbitrarily 
assigning which mean is to be subtracted from the other. The following SAS syntax is used 
to obtain the simple, simple main effect tests and confidence intervals for biofeedback 
within specific levels of drug and when diet is absent for the data in Chapter 8, Table 12;

PROC GLM; 
CLASS biofeed drug diet; 
MODEL bp = biofeed|drug|diet /CLPARM;
CONTRAST 'biofeedback w drug X, diet absent' biofeed 1 -1 biofeed*drug 1 0 0 -1 
biofeed*diet 1 0 -1 biofeed*drug*diet 1 0 0 0 0 0 -1;
ESTIMATE 'biofeedback w drug X, diet absent' biofeed 1 -1 biofeed*drug 1 0 0 -1 
biofeed*diet 1 0 -1 biofeed*drug*diet 1 0 0 0 0 0 -1;
CONTRAST 'biofeedback w drug Y, diet absent' biofeed 1 -1 biofeed*drug 0 1 0 0 -1 
biofeed*diet 1 0 -1 biofeed*drug*diet 0 0 1 0 0 0 0 0 -1;
ESTIMATE 'biofeedback w drug Y, diet absent' biofeed 1 -1 biofeed*drug 0 1 0 0 -1 
biofeed*diet 1 0 -1 biofeed*drug*diet 0 0 1 0 0 0 0 0 -1;
CONTRAST 'biofeedback w drug Z, diet absent' biofeed 1 -1 biofeed*drug 0 0 1 0 0 -1 
biofeed*diet 1 0 -1 biofeed*drug*diet 0 0 0 0 1 0 0 0 0 0 -1;
ESTIMATE 'biofeedback w drug Z, diet absent' biofeed 1 -1 biofeed*drug 0 0 1 0 0 -1 
biofeed*diet 1 0 -1 biofeed*drug*diet 0 0 0 0 1 0 0 0 0 0 -1;
RUN;

* The following SAS syntax is used to obtain the simple, simple main effect tests for drug
within specific levels of biofeedback and when diet is absent for the data in Chapter 8, 
Table 12;

PROC GLM; 
CLASS biofeed drug diet; 
MODEL bp = biofeed|drug|diet;
CONTRAST 'drug w biofeedback present, diet absent' drug 1 -1 biofeed*drug 0 0 0 1 -1 
drug*diet 1 0 -1 biofeed*drug*diet 0 0 0 0 0 0 1 0 -1,drug 1 1 -2 biofeed*drug 0 0 0 1 1 -2 drug*diet 1 0 1 0 -2 
biofeed*drug*diet 0 0 0 0 0 0 1 0 1 0 -2;
CONTRAST 'drug w biofeedback absent, diet absent' drug 1 -1 biofeed*drug 1 -1 
drug*diet 1 0 -1 biofeed*drug*diet 1 0 -1, drug 1 1 -2 biofeed*drug 1 1 -2 drug*diet 1 0 1 0 -2 
biofeed*drug*diet 1 0 1 0 -2;
RUN;

* More specific mean comparisons may also be of interest. For the numerical example, we 
compare individual cell means for the drugs when biofeedback is either present or absent 
and diet is absent. We begin with the individual cell mean comparisons when biofeedback is
present. The syntax to follow generates the results shown in Table 8.18. We also provide 
confidence intervals similar to the intervals shown in Table 8.22. There is one important 
difference between the confidence intervals reported here and the intervals shown in 
Table 8.22, however. The intervals reported here do not use a multiple comparison procedure,
while Table 8.22 uses the Tukey HSD multiple comparison procedure. As of this writing, it 
is not possible to directly obtain the correct Tukey HSD confidence intervals for this more 
complex analysis. One could obtain the Tukey intervals by hand through using the parameter 
estimates and standard errors shown along with obtaining the appropriate critical value to 
form the Tukey HSD confidence intervals. The following SAS syntax is used to obtain the 
tests and confidence intervals for individual cell mean comparisons between levels of drug 
when biofeedback is absent and diet is absent for the data in Chapter 8, Table 12;

PROC GLM; 
CLASS biofeed drug diet; 
MODEL bp = biofeed|drug|diet /CLPARM;
CONTRAST 'drug X vs drug Y, biofeedback absent, diet absent' drug 1 -1 biofeed*drug 0 0 0 1 -1 
drug*diet 1 0 -1 biofeed*drug*diet 0 0 0 0 0 0 1 0 -1;
ESTIMATE 'drug X vs drug Y, biofeedback absent, diet absent' drug 1 -1 biofeed*drug 0 0 0 1 -1 
drug*diet 1 0 -1 biofeed*drug*diet 0 0 0 0 0 0 1 0 -1;
CONTRAST 'drug X vs drug Z, biofeedback absent, diet absent' drug 1 0 -1 biofeed*drug 0 0 0 1 0 -1 
drug*diet 1 0 0 0 -1 biofeed*drug*diet 0 0 0 0 0 0 1 0 0 0 -1;
ESTIMATE 'drug X vs drug Z, biofeedback absent, diet absent' drug 1 0 -1 biofeed*drug 0 0 0 1 0 -1 
drug*diet 1 0 0 0 -1 biofeed*drug*diet 0 0 0 0 0 0 1 0 0 0 -1;
CONTRAST 'drug Y vs drug Z, biofeedback absent, diet absent' drug 0 1 -1 biofeed*drug 0 0 0 0 1 -1 
drug*diet 0 0 1 0 -1 biofeed*drug*diet 0 0 0 0 0 0 0 0 1 0 -1;
ESTIMATE 'drug Y vs drug Z, biofeedback absent, diet absent' drug 0 1 -1 biofeed*drug 0 0 0 0 1 -1 
drug*diet 0 0 1 0 -1 biofeed*drug*diet 0 0 0 0 0 0 0 0 1 0 -1;
RUN;

* The following SAS syntax is used to obtain the tests and confidence intervals for 
individual cell mean comparisons between levels of drug when biofeedback is present and diet
is absent for the data in Chapter 8, Table 12;

PROC GLM; 
CLASS biofeed drug diet; 
MODEL bp = biofeed|drug|diet /CLPARM;
CONTRAST 'drug X vs drug Y, biofeedback present, diet absent' drug 1 -1 biofeed*drug 1 -1 
drug*diet 1 0 -1 biofeed*drug*diet 1 0 -1;
ESTIMATE 'drug X vs drug Y, biofeedback present, diet absent' drug 1 -1 biofeed*drug 1 -1 
drug*diet 1 0 -1 biofeed*drug*diet 1 0 -1;
CONTRAST 'drug X vs drug Z, biofeedback present, diet absent' drug 1 0 -1 biofeed*drug 1 0 -1 
drug*diet 1 0 0 0 -1 biofeed*drug*diet 1 0 0 0 -1;
ESTIMATE 'drug X vs drug Z, biofeedback present, diet absent' drug 1 0 -1 biofeed*drug 1 0 -1 
drug*diet 1 0 0 0 -1 biofeed*drug*diet 1 0 0 0 -1;
CONTRAST 'drug Y vs drug Z, biofeedback present, diet absent' drug 0 1 -1 biofeed*drug 0 1 -1 
drug*diet 0 0 1 0 -1 biofeed*drug*diet 0 0 1 0 -1;
ESTIMATE 'drug Y vs drug Z, biofeedback present, diet absent' drug 0 1 -1 biofeed*drug 0 1 -1 
drug*diet 0 0 1 0 -1 biofeed*drug*diet 0 0 1 0 -1;
RUN;

* The final statistical tests to be illustrated here are simple main effects. Specifically, 
the tests of interest are the simple main effect of biofeedback when diet is present 
(averaging over the levels of drug) and the simple main effect of drug when diet is present
(averaging over the levels of biofeedback). The results obtained here duplicate the results 
illustrated in Table 8.19. Note that in the SAS "slice" output, the second row of results 
corresponds to the diet present condition. Also, the "drug*diet" table contains the simple 
main effects of drug at specific levels of diet, while the "biofeed*diet" table contains 
the simple main effects of biofeedback at specific levels of diet. Further, the confidence 
interval for the simple main effect of biofeedback within the diet present condition is 
replicated here through an estimate statement. It should be noted that the confidence 
interval should be multiplied by -1 to literally replicate the results in Table 8.21 for 
the same reason mentioned earlier in the section on simple, simple main effects. The 
following SAS syntax is used to obtain the simple main effects of biofeedback and drug when 
diet is present and the confidence interval for the simple main effect of biofeedback when 
diet is present for the data in Chapter 8, Table 12;

PROC GLM; 
CLASS biofeed drug diet; 
MODEL bp = biofeed|drug|diet /CLPARM;
LSMEANS biofeed*diet/SLICE=diet; 
LSMEANS drug*diet/SLICE=diet; 
ESTIMATE 'simple main effect of biofeedback when diet is present' biofeed 3 -3 biofeed*drug 1 1 1 -1 -1 -1 
biofeed*diet 0 3 0 -3 biofeed*drug*diet 0 1 0 1 0 1 0 -1 0 -1 0 -1 /DIVISOR=3; 
RUN;

Back to chapter index

Chapter 9. ANCOVA and blocking

Table 1 · Comparing final weight after adjustment for baseline weight

Download SAS program · Link to this example · Archived copy

*
chapter_9_table_1

The following data represent a pre-post design, where a training program designed to
assist people in losing weight is evaluated. An initial measure of weight is 
collected to use as a baseline measure (specifically as a covariate in the present 
analysis) and then randomly assign participants to one of two groups. At the end of 
the training program another measure of weight is obtained. The question of interest 
is: "did the participants who received the treatment lose more weight than those that 
were assigned to the wait-list control group?" 

As before, we will make use of the GLM procedure. The difference in the case of an
ANCOVA is that the effect of the covariate will be included on the right hand side of
the equals sign, as was the case previously with the grouping factor. The difference 
for covariates is that they are (generally) not classification variables but 
quantitative variables and are thus not included on the class line as grouping variables
generally are. Note that the /SOLUTION option is given on the model line. This is 
necessary in order for SAS to print the parameter estimates.

Note that the Type III sums of squares is what is generally of interest in this context, 
and it is these that are reported in the text.
;


LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c9t1;
       SET md.chapter_9_table_1;
PROC GLM DATA=c9t1;
CLASS group;
MODEL y = x group / SOLUTION;
RUN;
Table 7 · Comparing three depression treatments after adjustment for baseline scores

Download SAS program · Link to this example · Archived copy

*
chapter_9_table_7

The following data represent a three group pre-post design, where 30 depressives
were randomly assigned to one of three conditions. The primary question of 
interest is: "do individuals in some groups change more on their measures of 
depression than do individuals in other groups?"

As before, we will make use of the GLM procedure. The difference in the case of an
ANCOVA as compared to an ANOVA is that the effect of the covariate will be included 
on the right hand side of the equal sign, as was the case previously with the grouping 
factor. The difference for covariates is that they are (generally) not classification 
variables but quantitative variables and are thus not included on the class line as 
grouping variables generally are. 

Note that the /SOLUTION option is given on the model line. This is necessary in order 
for SAS to print the parameter estimates. Also notice that we have included an
LSMEANS option. The LSMEANS option outputs the adjusted mean for the class variable(s)
that are specified. The options following the the "/" on the LSMEANS line are for 
pairwise adjusted mean comparisons (obtained by including PDIFF) and that the 
confidnece limits that are adjusted using Tukey's WSD (or HSD) method (obtained 
by includeding ADJUST=TUKEY).

The results given by the SAS syntax below yield the results given in Tables 9.8 and 9.9
and 9.10.
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c9t7;
       SET md.chapter_9_table_7;
PROC GLM DATA=c9t7;
CLASS cond;
MODEL post = cond pre / SOLUTION;
LSMEANS cond / PDIFF CL ADJUST=TUKEY;
RUN;
Table 11 · Motor-control errors with participants blocked by age

Download SAS program · Link to this example · Archived copy

*
chapter_9_table_11

The question of interest in the present situation assumes that there are three blocks of 
elderly participants, six per block. The elderly participants are sorted into the three 
blocks as a function of their age. The purpose of the study was to assess the effect of 
age on motor control, measured by the number of errors on a certain task (where there 
were three tasks). 

The following syntax is used to replicate the results given in Table 9.12. The first
GLM statement corresponds to the randomized block design, the second GLM statement
corresponds to the ANOVA design, and the third GLM statement corresponds to the 
ANCOVA (where x is used as a covariate) design. Note that for the ANCOVA we will, as 
usual, make use of the Type III sums of squares (even though by default SAS also
prints the Type I sums of squares).
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c9t11;
       SET md.chapter_9_table_11;
title 'Randomized Block Design';
PROC GLM DATA=c9t11;
CLASS block task;
MODEL y = task block task*block;
RUN;
title 'ANOVA';
PROC GLM DATA=c9t11;
CLASS task;
MODEL y = task;
RUN;
title 'ANCOVA';
PROC GLM DATA=c9t11;
CLASS task;
MODEL y = task x;
RUN;

Back to chapter index

Chapter 10. Random and nested factors

Table 5 · An ACT training study with schools assigned to conditions

Download SAS program · Link to this example · Archived copy

* 
chapter_10_table_5

The data in Table 10.5 consist of simulated ACT scores from 40 participants where 10 
participants were selected from each of four schools. It is assumed that the schools are 
randomly selected from a population of schools in America in order to generalize the 
results found. Two schools (and thus, 20 participants) are randomly assigned to the 
computer-based ACT training program, while the other two schools are randomly assigned to
the standard paper-and-pencil program in order to assess the effectiveness of these 
different types of programs;

LIBNAME md 'd:\data files by type\sas data files\tables';
DATA c10t5; 
SET md.chapter_10_table_5;

*The primary hypothesis of interest is whether the standard paper-and-pencil and 
computer-based ACT training programs differ in effectiveness. The following output 
generates the output to assess this hypothesis. The following SAS syntax is used to obtain  
the mixed model ANOVA on the data in Chapter 10, Table 5;

PROC GLM; 
CLASS a b; 
MODEL act = a b a*b;
TEST H = a E = a*b;
RUN; 
Table 9 · Clinical severity ratings with trainees nested within gender

Download SAS program · Link to this example · Archived copy

*
chapter_10_table_9

The data in Table 10.9 consist of general severity rating scores from 24 participants 
after each participant receives therapy from one of 6 therapist trainees. Three of the 
trainees are males while the other three trainees are females. In this sense, the trainees 
are nested within their particular gender; 

LIBNAME md 'd:\data files by type\sas data files\tables';
DATA c10t9;
SET md.chapter_10_table_9; 

* The hypothesis of primary interest is determining the effect of gender on severity score
ratings. The following syntax provides the output necessary to test this hypothesis. The 
results obtained from the output replicate the results shown in Table 10.9. The following 
SAS syntax is used to obtain the ANOVA for the nested design on the data in Chapter 10, 
Table 9;

PROC GLM DATA=c10t9; 
CLASS gender trainee; 
MODEL severity=gender trainee(gender); 
RANDOM trainee(gender)/TEST; 
RUN; 

Back to chapter index

Chapter 11. One-way within-subjects designs

Table 1 · Comparing two conditions measured on the same individuals

Download SAS program · Link to this example · Archived copy

*
chapter_11_table_1

For the present data set, six individuals were observed under two 
different conditions. The question of interest is: 'does the mean 
of the scores in Condition 1 differ from the mean of the scores
in Condition 2.' 
 
To perform the repeated measures analysis, PROC GLM is used. On the MODEL
statement line the repeated factors are placed on the left side of the equals
sign. Notice that for the present analysis no covariates or group 
identifiers are included on the right side of the equal sign. However,
/NOUNI is included, which simply tells SAS not to perform separate
univariate analyses on each level of the condition (ycond1 and ycond2 here).
The REPEATED line below the model statement tells SAS what factor is 
being repeated (this can be named anything). The results of this 
analysis match those given in Table 11.3. 

Note that by default results for the multivariate repeated measures
analysis as well as the results for univariate repeated measures
analysis are given. At the present time we are only interested 
in the univariate analyses (even though they are equivalent in 
this particular instance). 

Further note that because there are only two levels of the 
repeated factor, a paired samples t test could have been performed.
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c11t1;
       SET md.chapter_11_table_1;
PROC GLM;
MODEL ycond1 ycond2 = / NOUNI;
REPEATED condition;
RUN;
Table 4 · Printing the repeated-measures data

Download SAS program · Link to this example · Archived copy

*
chapter_11_table_4

There are no analyses conducted on this data set.
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c11t4;
       SET md.chapter_11_table_4;
PROC PRINT;
RUN;
Table 5 · Change in McCarthy cognitive scores across four occasions

Download SAS program · Link to this example · Archived copy

*
chapter_11_table_5

For the present data set, 12 children were each observed four times 
over an 18 month period. The dependent variable is the age-normed 
general cognitive score on the McCarthy Scales of Children's 
Abilities. Interest is to determine if the children were sampled 
from a population where growth in cognitive ability is more rapid 
or less rapid than average.  
 
To perform the repeated measures analysis, PROC GLM is used. On the 
MODEL statement line the repeated factors are placed on the left 
side of the equals sign. Notice that for the present analysis no 
covariates or group identifiers are included on the right side of 
the equals sign. However, /NOUNI is included, which simply tells SAS 
not to perform separate univariate analyses on each level of the 
factor. The REPEATED line below the model statement 
tells SAS what factor is being repeated (this can be named anything). 
The results of this analysis match those given on page 539. 

Note that by default results for the multivariate repeated measures
analysis as well as the results for univariate repeated measures
analysis are given. At the present time we are only interested 
in the univariate analysis (where sphericity is assumed). 

Note that SAS gives the Greenhouse-Geisser Epsilon (Epsilon hat) 
and the Huynh-Feldt Epsilon (Epsilon tilda) by default, which will
soon be of interest.
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c11t5;
       SET md.chapter_11_table_5;
PROC GLM;
MODEL months30 months36 months42 months48 = / SOLUTION NOUNI;
REPEATED months;
RUN;
;
Table 19 · Mean squares for intraclass correlations of judges’ ratings

Download SAS program · Link to this example · Archived copy

*
chapter_11_table_19

For the present (hypothetical) data set (taken from Shrout and Fleiss,
(1979) consists of six participants who are ranked by four judges. 

As is pointed out on page 563, the structure of Table 11.19 is 
analogous to that of Table 11.5 (repeated measures). However, notice 
that in the data file that the data is entered differently. For the 
repeated measures designs (e.g., 11.5), each row corresponded to a 
different participant while each column corresponded with another 
measurement. The main reason for the difference in how the data was 
entered is mainly because of the procedures used to analyze the data. 
SPSS and SAS allow repeated measures data to be entered in a 
"participants by occasions" fashion, whereas in order to get the 
appropriate mean squares to carryout the intraclass correlations for 
the data given in Table 11.19, a mixed effects (one fixed factor and
one random factor) ANOVA needed to be performed. It should be pointed 
out that the repeated measures data could have been entered in a similar
fashion as Table 19 and 29, however, the powerful repeated measures 
procedure in SPSS and SAS would not have been directly utilized. 

Because the intraclass correlations as given towards the end of Chapter
11 are not directly obtainable via SPSS or SAS, mixed effects ANOVAs 
are utilized such that the appropriate mean squares can be inserted 
into the appropriate formulas. Note that we obtain the mean squares by 
way of a mixed effects ANOVA, but either a random effects or a fixed 
effects ANOVA could have been utilized, because the corresponding mean 
squares are equivalent in each situation (the F ratios, which are not 
of interest here, are what is different).

The analysis proceeds by making use of Proc GLM, however because there 
is a random factor, a random statement is also included where the random
effect is placed to the right of the random statement.
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c11t19;
       SET md.chapter_11_table_19;
PROC GLM;
CLASS judge subject;
MODEL rating = judge subject judge*subject;
RANDOM subject;
RUN;

Table 20 · Printing the second ratings dataset for the intraclass correlation example

Download SAS program · Link to this example · Archived copy

*
chapter_11_table_20

The analysis of the data contained in Table 11.20 is carried out 
in exactly the same manner as was the data contained in Table 
11.19. Thus, a mixed effects ANOVA model is performed in order 
to obtain the mean squares which are then used in the formulas 
give towards the end of Chapter 11.  
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c11t20;
       SET md.chapter_11_table_20;
PROC PRINT;
RUN;

Back to chapter index

Chapter 12. Higher-order within-subjects designs

Table 1 · Reaction time with angle and noise varied within participants

Download SAS program · Link to this example · Archived copy

* 
chapter_12_table_1

The data in Table 12.1 consist of reaction time scores for 10 participants where each 
participant contributes 6 scores to the analysis. In particular, each participant is 
exposed to each of 6 experimental conditions, which are obtained by factorially combining 
angle (0, 4, and 8) with noise (absent and present); 

LIBNAME md 'd:\data files by type\sas data files\tables';
DATA c12t1; 
SET md.chapter_12_table_1;

* First, the tests of interest are the omnibus tests within the two-factor within-subjects 
ANOVA. The following SAS syntax is used to obtain the omnibus tests for the two-way 
within-subjects ANOVA on the data in Chapter 12, Table 1;

PROC GLM;  
MODEL abs0 abs4 abs8 pres0 pres4 pres8 = /NOUNI;
REPEATED noise 2, angle 3;
RUN;

* As shown on page 580, we may also want to test the marginal means of one of the 
within-subjects factors. In particular, we test for the quadratic effect of angle averaging
over noise here. Note that the particular test of interest corresponds to the 
"Contrast Variable: angle_2" heading. The following SAS syntax is used to obtain the test 
of the quadratic trend of angle averaging over noise from the data in Chapter 12, Table 1;

PROC GLM;  
MODEL abs0 abs4 abs8 pres0 pres4 pres8 = /NOUNI;
REPEATED noise 2, angle 3 POLYNOMIAL /SUMMARY;
RUN;

* If one were interested in utilizing the pooled error term for the test of quadratic trend 
of angle, the pooled error term is the mean square used for the angle main effect through 
the mixed-model approach. Dividing the mean square in the numerator of the test of the 
quadratic trend of angle (used by the separate error term approach) by the pooled error 
term yields the appropriate F ratio for this test. This result should be identical to the F
ratio using the pooled error term found on page 580.  

* Also of interest are the simple effects for angle within specific levels of noise and the
simple effects for noise within specific levels of angle. The following syntax produces the
results for these analyses that replicate the results found in Table 12.6. The following 
SAS syntax is used to obtain the tests of simple effects for the two-way within-subjects 
ANOVA on the data in Chapter 12, Table 1;

* Test of simple effect of angle within noise absent;

PROC GLM;  
MODEL abs0 abs4 abs8 = /NOUNI;
REPEATED angle 3;
RUN;

* Test of simple effect of angle within noise present;

PROC GLM;  
MODEL pres0 pres4 pres8 = /NOUNI;
REPEATED angle 3;
RUN;

* Test of simple effect of noise within angle 0;

PROC GLM;  
MODEL abs0 pres0 = /NOUNI;
REPEATED noise 2;
RUN;

* Test of simple effect of noise within angle 4;

PROC GLM;  
MODEL abs4 pres4 = /NOUNI;
REPEATED noise 2;
RUN;

* Test of simple effect of noise within angle 8;

PROC GLM;  
MODEL abs8 pres8 = /NOUNI;
REPEATED noise 2;
RUN;

* Also, potentially of interest are interaction contrasts. We test the difference between 
angle 0 and angle 8 to determine if this difference is different for the noise present and 
noise absent conditions. This result obtained corresponds to the F test shown on page 583 
using a separate error term. It is important to note that, as stated on page 583, using 
separate error terms is generally advisable, and these are the error terms used here. 
However, one can still use the pooled error term by running the omnibus tests and forming F
tests for more specific contrasts using the error term from that analysis. The following 
SAS syntax is used to obtain the test of the interaction contrast shown on pages 582-583 for
the two-way within-subjects ANOVA on the data in Chapter 12, Table 1 (Note that the 
interaction corresponds to the test of interest);

PROC GLM;  
MODEL abs0 abs8 pres0 pres8 = /NOUNI;
REPEATED noise 2, angle 2;
RUN;

* With respect to the adjusted univariate mixed-model tests, it should be noted that SAS 
provides estimates of epsilon and adjusted p-values for the Greenhouse-Geiser and 
Hyunh-Feldt estimators of epsilon. The results obtained for the adjusted and unadjusted 
omnibus tests using the SAS syntax for the omnibus tests illustrated near the beginning of 
this file are shown in Table 12.13;






Table 15 · Age group and angle in a split-plot reaction-time study

Download SAS program · Link to this example · Archived copy

*
chapter_12_table_15

The data in Table 12.15 consist of reaction time scores for 10 young participants where 
each participant contributes 3 scores to the analysis. In particular, each participant is
exposed to each of 3 experimental conditions, angle (0, 4, and 8). For the current analyses
Table 12.15 is appended to Table 12.7, which contains reaction time scores for 10 old 
participants for angles of 0, 4, and 8. Thus, it is necessary to perform some data 
management before analyzing the data. The following SAS syntax is used to form the data set
using Tables 12.15 and 12.7 along with adding a variable to the data set corresponding to 
the age factor;

LIBNAME md 'd:\data files by type\sas data files\tables';
DATA c12t15; 
SET md.chapter_12_table_15;
PROC APPEND BASE=c12t15 
   DATA=try.chapter_12_table_7;
RUN;
DATA c12t15;
SET c12t15;
INPUT age;
CARDS; 
1 
1 
1 
1 
1 
1 
1
1
1
1
2
2
2
2
2
2
2
2
2
2
;
RUN;

* Now we move on to performing the split-plot ANOVA. The first tests of interest here are
the omnibus tests within the split-plot ANOVA. The following SAS syntax replicates the 
results shown in Table 12.19; 

PROC GLM;  
CLASS age; 
MODEL angle0 angle4 angle8 = age;
REPEATED angle 3;
RUN;

* Also, in order to illustrate how to perform tests of marginal means in the context of 
split-plot designs, we test for the quadratic trend of the angle effect, averaging over 
age. This tests corresponds to the test performed on page 600 using a separate error term. 
If one were interested in using the pooled error term approach for this test of the 
quadratic trend of angle, one could divide the mean square for the contrast associated with
the quadratic trend of angle by the mean square used as the denominator for the omnibus 
test of the angle main effect using the univariate mixed-model approach. Using the syntax 
suggested here, this pooled error term is the mean square found under the headings 
"Repeated Measures Analysis","Within", and then "Type III Model ANOVA" within the row 
entitled "Error(angle)" in the unvariate mixed-model output;

* The following SAS syntax is used to test the quadratic trend of angle averaging over age
using the separate error term approach;

PROC GLM;  
CLASS age; 
MODEL angle0 angle4 angle8 = age;
REPEATED angle 3 POLYNOMIAL /SUMMARY;
RUN;
 
* Also of interest are the simple effects for angle within specific levels of noise and the 
simple effects for noise within specific levels of angle. Specifically, the tests shown 
here are the simple effect of angle for young participants and the simple effect of age at 
angle 0. It is important to note that one could either use the separate error term or 
pooled error term approach for these tests. The following syntax produces the tests of the 
simple effect angle for young participants using the separate error term approach shown on 
page 602. Note that the young participants are coded as “2” for the age variable and thus 
the output corresponding to this value is of interest here; 

PROC GLM;  
CLASS age;
WHERE(age=2); 
MODEL angle0 angle4 angle8 = /NOUNI;
REPEATED angle 3;
RUN;

* There is no straightforward method to calculating the pooled error term for the simple 
effect of angle for young participants, other than obtaining the pooled error term from the
omnibus test output and obtaining the appropriate F ratio through hand calculations. One 
should find the results obtained from these hand calculations should agree with the F ratio 
for the pooled error term found on page 602.;

* As mentioned, we are also interested in obtaining the test of the simple effect of age at
angle 0. The following syntax produces this test as shown on page 603 using a separate 
error term; 

PROC GLM;  
CLASS age; 
MODEL angle0 = age;
RUN;

* As was the case in for the SPSS syntax, one can find the pooled error term and test in 
this particular situation by first running the analyses for the simple effects of angle 0, 
4, and 8, then taking an unweighted average of the error mean squares used for the tests of
these simple effects. One would then use this error mean square to calculate the 
appropriate F ratio. One would then need to find the critical F value (using the 
appropriate degrees of freedom) to test the observed F ratio for statisical significance. 
The result obtained should correspond to the result shown on page 602. The following syntax 
produces the tests of the simple effect of age at angle 4 and 8 in order to obtain the 
pooled error term;

* simple effect of age at angle 4;

PROC GLM;  
CLASS age; 
MODEL angle4 = age;
RUN;

* simple effect of age at angle 8;

PROC GLM;  
CLASS age; 
MODEL angle8 = age;
RUN;

* Other tests of potential interest include interaction contrasts. In particular, it may be
of interest to determine if the quadratic trend is different for young and old participants. 
As is the case for other more specific group comparisons, either a separate or a pooled 
error term could potentially be used. In fact the syntax used to obtain the test of the 
quadratic trend of angle averaging over age also yields the test of whether the quadratic 
trend is different for the old and yound participants using the separate error term. This 
test is found under "Contrast variable: angle_2" in the row denoted "age" in the output 
corresponding to the SAS syntax mentioned. If one were interested in using the pooled error 
term, then the syntax for the omnibus tests should be run, and the denominator used for the
test of the omnibus interaction test for the univariate mixed-model approach should be used
as the denominator of the interaction contrast to form the appropriate F ratio;


























Table 21 · Drug effects on aggression in a replicated Latin square

Download SAS program · Link to this example · Archived copy

* 
chapter_12_table_21

The data in Table 12.21 consist of hypothetical aggressiveness scores for 6 monkeys who 
have been exposed to three types of drugs (A, B, and C). In order to control for potential 
order effects, a Latin square design is utilized. In particular, two randomly constituted 
squares are formed with three monkeys randomly assigned to each square and also randomly 
assigned to the particular row of the square that assigns the order that they are exposed 
to treatment;

LIBNAME md 'd:\data files by type\sas data files\tables';
DATA c12t21; 
SET md.chapter_12_table_21;

* The hypothesis of primary interest is whether the drugs differ in their effectiveness in 
controlling aggression in the monkeys. Thus, the test of the condition main effect is of 
primary interest. The current procedure reproduces the results for test of the condition 
main effect shown on page 615. The following SAS syntax is used to obtain the test of 
condition for an ANOVA on a Latin square design from the data in Chapter 12, Table 21
The LSMEANS line yields the results given in Table 12.22.;

PROC GLM;  
CLASS subject cond time;
MODEL dv = subject cond time / solution;
RANDOM subject;
LSMEANS subject cond time;
RUN;

Back to chapter index

Chapter 13. Multivariate repeated measures

Table 1 · Comparing repeated measurements on two occasions

Download SAS program · Link to this example · Archived copy

*
chapter_13_table_1

For the hypothetical data contained in Table 13.1, five participants 
were measured at two occasions. The question of interest is: "is there 
a difference between Time 1 and Time 2 scores?"

To perform the repeated measures analysis, PROC GLM is used. The 
analysis proceeds in the same manner as it did for the univariate
approach in Chapter 11. The repeated factors are placed on the left 
side of the equal sign. Notice that for the present analysis, no 
covariates or group identifiers are included on the right side of 
the equal sign. Recall that the /NOUNI option on the model line 
means to not report tests of the univariate effects for each level 
of the time factor.

Although the univariate and multivariate repeated measures designs are
performed with the same code, the difference between the approaches 
is in the output. Whereas for the univariate approach, the results were
given under 'Univariate Tests of Hypotheses for Within Subject 
Effects,' the results for the multivariate analysis are given under
the heading of 'Manova Test Criteria....'
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c13t1;
       SET md.chapter_13_table_1;
PROC GLM;
MODEL time1 time2 = / NOUNI;
REPEATED time;
RUN;
;
Table 2 · Comparing repeated measurements on three occasions

Download SAS program · Link to this example · Archived copy

*
chapter_13_table_2

For the hypothetical data contained in Table 13.2, eight participants 
were measured on three occasions. The hypothesis of intereste is: 'are
the population means of the scores equal at all three timepoints?'

The results of the data contained in Table 13.2 proceed in exactley 
the same way they did for the data contained in Table 13.1 (as well
as it did for the repeated measures given in Chapter 11). Because 
explanations of this type of design using the multivariate 
approach have already been given (e.g., Table 13.1), step-by-step 
instructions are not given here, but the analysis is performed.
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c13t2;
       SET md.chapter_13_table_2;
PROC GLM;
MODEL time1 time2 time3 = / NOUNI;
REPEATED time;
RUN;

Table 6 · Multivariate repeated measures for McCarthy cognitive scores

Download SAS program · Link to this example · Archived copy

*
chapter_13_table_6

The McCarthy IQ data is given in Table 13.6 (i.e., the same data 
given in Table 11.5). The hypothesis of interest is the same
as it was for Table 11.5, however the method of answering the
hypothesis is what differs. 

The results of this analysis are obtained in exactly the same 
manner they were for Table 13.1 (and the univariate approach given 
of Chapter 11). Because SAS reports both the univariate and the 
multivariate approaches by default, the results must be interpreted 
with care to ensure that the approach of interest is being reported 
and interpreted. Because explanations of this type of design  
using the multivariate approach have already been given (e.g., 
Table 13.1 and the repeated measues designs of Chapter 11), 
step-by-step instructions are not given here, yet the analysis
is still carried out
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c13t6;
       SET md.chapter_13_table_6;
PROC GLM;
MODEL months30 months36 months42 months48 = / NOUNI;
REPEATED months;
RUN;
;
Table 12 · Testing linear and quadratic trends with contrast scores

Download SAS program · Link to this example · Archived copy

*
chapter_13_table_12

For the hypothetical data contained in Table 13.2, the linear and 
quadratic D variables were formed by making use of the appropriate 
coefficients from Appendix Table A.10. Because the eight participants 
were measured at three occasions, both a linear and a quadratic effect
can be tested. The question of interest in this instance is: "Is there
a linear and/or quadratic trend exhibited by the group over time?" Recall
that in the book (pages 646-647) it was shown that the D variables for 
linear and quadratic effects led to an omnibus F test of 19.148, which
was a value previously obtained for the omnibus effect. Because the 
particular values chosen for the D variables do not matter (unless it 
leads to a linear combination of columns), we will focus only on the 
tests of the individual contrasts when analyzing the data given in 
Table 12.

Because the data is already in the form of a D variable, all that needs
to be done is to test the data to see if the mean differs from zero. 
The easiest way to do this is by making use of PROC TTEST and 
specifying the null value to be zero. 
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c13t12;
       SET md.chapter_13_table_12;
PROC TTEST DATA=c13t12 H0=0;
RUN;

Back to chapter index

Chapter 14. Higher-order multivariate designs

Table 1 · Visual interference and letter-recognition time

Download SAS program · Link to this example · Archived copy

*
chapter_14_table_1

For the hypothetical data contained in Table 14.1, a perceptual 
psychologist studying the visual system was interested in determining 
the extent to which interfering visual stimuli slow the ability to 
recognize letters. Participants are brought into a laboratory where 
they are seated in front of a tachistoscope. Variations in the 
presentations of letters is examined with interest being on the 
reaction time for target letters presented either in the center of 
the screen or off centered with and without "noise" accompanying the 
target letters. 

To perform the repeated measures analysis, PROC GLM is used. The 
analysis begins by specifying the four dependent variables on the 
left side of the equals sign. Note that angle is 'changing faster' 
than 'noise.' Specifically the first two dependent variables entered
are both noise absent, with the first being angle=0 and the second
being angle=8. In this sense we say that angle is 'changing
fastest.' Because angle is 'changing fastest,' it is included 
second on the REPEATED LINE (implying that because noise is 
'changing slowest,' it is included first on the REPEATED line).
As usual we have included / NOUNI on the model line. This tells
SAS that we do not want it to perform univariate tests for
each of the four dependent variables.
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c14t1;
       SET md.chapter_14_table_1;
PROC GLM;
MODEL abs0 abs8 pres0 pres8 = / NOUNI;
REPEATED noise 2, angle 2;
RUN;

Table 3 · Printing the D variables for repeated-measures contrasts

Download SAS program · Link to this example · Archived copy

*
chapter_14_table_3


For the hypothetical data contained in Table 14.1, Table 14.3 gives the
set of D variables. The D variables are subsequently used to analyze the
data given in Table 14.1. Because we analyzed the data contained in Table
14.1 directly by making use of the Repeated Measures procedures, 
performing analyses on the D variables themselves is unnecessary.
For the hypothetical data contained in Table 14.4, Table 14.5 gives 
an appropriate set of D variables. The D variables are subsequently 
used to analyze the data given in Table 14.4. Because we analyzed the
data contained in Table 14.4 directly, by making use of the Repeated 
Measures procedures, performing analyses on the D variables themselves 
is unnecessary. The D variables are given in the text for pedagogical 
and computational reasons. However, if one were interested in 
analyzing the data from Table 14.3, because there are only two levels 
of both factors, PROC TTEST could be used. 
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c14t3;
       SET md.chapter_14_table_3;
PROC PRINT;
RUN;

Table 4 · A repeated-measures analysis of noise and three visual angles

Download SAS program · Link to this example · Archived copy

*
chapter_14_table_4

For the hypothetical data contained in Table 14.1, a perceptual 
psychologist studying the visual system was interested in determining 
the extent to which interfering visual stimuli slow the ability to 
recognize letters. Participants are brought into a laboratory where 
they are seated in front of a tachistoscope. Variations in the 
presentations of letters is examined with interest being on the reaction 
time for target letters presented either in the center of the screen or 
off centered with and without "noise" accompanying the target letters. 


To perform the repeated measures analysis, PROC GLM is used. The 
analysis begins by specifying the six dependent variables on the 
left side of the equals sign. Note that angle is 'changing faster' 
than noise. Specifically the first three dependent variables entered
are all noise absent, with the first being angle=0 the second angle=4
and the third angle=8. In this sense we say that angle is 'changing
fastest.' Because angle is 'changing fastest,' it is included 
second on the REPEATED LINE (implying that because noise is 
'changing slowest,' it is included first on the REPEATED line).
As usual we have included / NOUNI on the model line. This tells
SAS that we do not want it to perform univariate tests for
each of the six dependent variables.
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c14t1;
       SET md.chapter_14_table_4;
PROC GLM;
MODEL abs0 abs4 abs8 pres0 pres4 pres8 = / NOUNI;
REPEATED noise 2, angle 3;
RUN;

Table 5 · Testing noise, angle, and their interaction with D variables

Download SAS program · Link to this example · Archived copy

*
chapter_14_table_5

For the hypothetical data contained in Table 14.4, Table 14.5 gives an 
appropriate and substantively interesting set of D variables. The D 
variables (rather than the raw data itself) is used because of the benefits 
and flexibility gained from analyzing the D variables directly (rather than
indirectly as we did with the Table 14.4 data). 

The results of the analysis when the D variables themselves are analyzed
can be obtained by making use of PROC GLM and PROC TTEST. Using PROC GLM 
with D variables for omnibus effects of the main effects and interaction 
requires separate PROC GLM statements with the extra specification
'MANOVA H =_ALL_'. The 'MANOVA H =_ALL_' tells SAS that we want to 
perform a MANOVA on the selected variables (here the D variables we 
defined) considering 'all' dependent variables simultaneously. If we
would have included all of the D variables in a single PROC GLM 
statement, we would have lost information about each of the main effects
and the interaction. Note that the reason we have not previously had
to specify 'MANOVA H =_ALL_' is because we specified that the variables
were repeated (as in the results from Table 14.1 and 14.4) and it was
thus unnecessary. 

Regarding the parameter estimates and confidence intervals for the 
D variables, because each D is analyzed with respect to only itself,
PROC TTEST can be used to obtain parameter estimates and 
confidence intervals. Note that the null hypothesis of interest here 
is that the population mean of the D variables is zero. 

Although we do not illustrate it here, forming other D variables and 
following the procedures outlined will lead to answers of other (potentially) 
interesting questions. For example, the 11th D variable of the chapter tests 
the difference between the eighth degree and the zeroth degree conditions when 
noise is present. Although we do not form and test such a D variable here, with 
the methods we have illustrated, such a D variable could easily be formed and 
analyzed. 
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c14t5;
       SET md.chapter_14_table_5;
Title 'Angle Main Effect';
PROC GLM;
MODEL d1 d2 = / NOUNI;
MANOVA H =_ALL_;
RUN;
Title 'Noise Main Effect';
PROC GLM;
MODEL d3 = / NOUNI;
MANOVA H =_ALL_;
RUN;
Title 'Interaction Main Effect';
PROC GLM;
MODEL d4 d5 = / NOUNI;
MANOVA H =_ALL_;
RUN;
Title 'Parameter Estimates and Confidence Intervals for D Variables';
PROC TTEST H0=0;
RUN;


Table 8 · Age-group differences at two visual angles

Download SAS program · Link to this example · Archived copy

*
chapter_14_table_8

For the hypothetical data contained in Table 14.8, a perceptual psychologist 
is interested in age differences ("young" and "old") in reaction time on a 
perceptual task. In addition, the psychologist is also interested in the effect 
of angle (zero degrees off center and eight degrees off center). The question of 
interest is to see if there are is a main effect of age, a main effect of angle, 
and an interaction between the two. 

The analysis of Table 14.8 literally combines what we have learned from the syntax
of repeated measures designs as well as from between subjects designs. For the 
analysis of this data we simply specify group as a classification variable and 
specify that our two dependent variables are repeated. 

The results obtained match those given in the text on pages 707 (for the between-
subject main effect), 709 (for the interaction), and 712 (for the within-subject 
main effect).
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c14t8;
       SET md.chapter_14_table_8;
PROC GLM;
CLASS group;
MODEL angle0 angle8 = group / NOUNI;
REPEATED angle 2;
RUN;

Table 10 · Age-group differences and contrasts across three visual angles

Download SAS program · Link to this example · Archived copy

*
chapter_14_table_10

The hypothetical data contained in Table 14.10 contains an additional
level of angle (four degrees) that was not considered in Table 14.8.

The analysis of Table 14.10 is analogous to that of Table 14.8. The only 
differences is that angle4 needs to be included on the left hand side of 
the equals sign and the levels of angle should be changed from '2' to '3'
on the REPEATED line. 

One way to test specific contrasts within PROC GLM for the repeated factors
without explicitly forming D variables is to specify the H and M matrices. 
The H matrix is the hypothesis of the between subject effects while the M 
matrices are for the within subject effects. H is specified as Intercept 
because do collapse across the between subject factor ignoring any 
interactive effects that may exist. We define the particular D variable 
(here polynomials) in the M matrix.


The results obtained match those given in the text on pages 714 (for the between-
subject main effect), 719 (for the within-subject main effect), and 721 (for 
the interaction). The results of the linear and quadratic effects are given
on page 728. 
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c14t10;
       SET md.chapter_14_table_10;
PROC GLM;
CLASS group;
MODEL angle0 angle4 angle8 = group / NOUNI;
REPEATED angle 3;
Title 'Test of the Linear Component';
MANOVA H=INTERCEPT  M=(-1 0 1,     
                       -1 0 1); 
Title 'Test of the Quadratic Component';
MANOVA H=INTERCEPT  M=(1 -2 1,     
                       1 -2 1); 
RUN;
*Between-Subject Effects at Fixed Levels of the Within Subjects Factor:
Below in the following three PROC GLM statements we perform between subject 
effects at fixed values of the repeated factor (angle here). Performing such 
analyses allows us to see if young and old differ at specific levels of the 
within subjects factor;
PROC GLM;
CLASS group;
MODEL angle0 = group;
RUN;
PROC GLM;
CLASS group;
MODEL angle4 = group;
RUN;
PROC GLM;
CLASS group;
MODEL angle8 = group;
RUN;
*Within-Subject Effects at Fixed Levels of Between-Subject Effects:
In the following two PROC GLM statements we test the within subjects effects 
at fixed values of the between subjects factor. Note that this tests treats
the error terms as separate and distinct.;
PROC GLM;
CLASS group;
WHERE (group=1);
MODEL angle0 angle4 angle8 = / NOUNI;
REPEATED angle 3;
RUN;
PROC GLM;
CLASS group;
WHERE (group=2);
MODEL angle0 angle4 angle8 = / NOUNI;
REPEATED angle 3;
RUN;
*Cell Mean Comparisons:
Here we test the linear and quadratic trends for the young (in the
first PROC GLM statement that follows) and then for the old 
participants (in the second PROC GLM statement that follows).;
PROC GLM;
CLASS group;
WHERE (group=1);
MODEL angle0 angle4 angle8 = / NOUNI;
REPEATED angle 3;
Title 'Test of the Linear Component for Young Group';
MANOVA H=INTERCEPT  M=(-1 0 1,     
                       -1 0 1); 
Title 'Test of the Quadratic Component for Young Group';
MANOVA H=INTERCEPT  M=(1 -2 1,     
                       1 -2 1); 
RUN;
PROC GLM;
CLASS group;
WHERE (group=2);
MODEL angle0 angle4 angle8 = / NOUNI;
REPEATED angle 3;
Title 'Test of the Linear Component for Old Group';
MANOVA H=INTERCEPT  M=(-1 0 1,     
                       -1 0 1); 
Title 'Test of the Quadratic Component for Old Group';
MANOVA H=INTERCEPT  M=(1 -2 1,     
                       1 -2 1); 
RUN;
*Testing Interaction Contrasts with D Variables: 
Here we explicitly form D variables to answer a hypothesis of 
interest. Specifically we create a new data set 'Dvars' and 
define the Linear and Quadratic D variables. We then test to 
see if the groups differ on their Linear and Quadratic D variables.;
DATA Dvars;
SET c14t10;
Linear = -1*angle0 + 0*angle4 + 1*angle8;
Quadratic = 1*angle0 + -2*angle4 + 1*angle8;
PROC GLM DATA=Dvars;
CLASS group;
MODEL Quadratic = group;
RUN;
PROC GLM DATA=Dvars;
CLASS group;
MODEL Linear = group;
RUN;


Back to chapter index

Chapter 15. Mixed-effects models for repeated measures

Table 1 · Fitting mixed models to repeated McCarthy scores

Download SAS program · Link to this example · Archived copy

*
chapter_15_table_1

We revisit the McCarthy data from Table 11.5 in Chapter 15. Notice, 
however, that when using PROC MIXED, the data needs to be entered
differently when we analyzed it earlier using PROC GLM. Rather than 
having N columns by p number of timepoints, PROC MIXED requires
the data to be entered in N*p rows, with a column identifying the 
participant and the timepoint. Included below is the data set of
Chapter 11.5 in the format required by PROC MIXED.

Because Chapter 15 provides all of the SAS syntax necessary to replicate
the results given in the chapter, and because explanations of the syntax
is also given in the text, most of the code given below is taken 
directly from the chapter without explanations of the commands and 
optional specifications.

Note the data structure necessary is different that used up to this point.
PROC GLM has different data set-up requirements when compared to the procedures
used up to this point. We will input the data directly as is discussed on 
page 715 of the text.
;

DATA c15t1;
INPUT id timecat iq;
time = timecat-30;
CARDS; *Datalines can also be used instead of CARDS;
1	30	108
1	36	96
1	42	110
1	48	122
2	30	103
2	36  117
2	42	127
2	48	133
3	30	96
3   36	107
3	42	106
3	48	107
4	30	84
4	36	85
4	42	92
4	48	99
5	30	118
5	36	125
5	42	125
5	48	116
6	30	110
6	36	107
6	42	96
6	48	91
7	30	129
7	36	128
7	42	123
7	48	128
8	30	90
8	36	84
8	42	101
8	48	113
9	30	84
9	36	104
9	42	100
9	48	88
10	30	96
10	36	100
10	42	103
10	48	105
11	30	105
11	36	114
11	42	105
11	48	112
12	30	113
12	36	117
12	42	132
12	48	130
;
TITLE 'Replication of Table 15.2';
PROC GLM;
CLASS timecat id;
MODEL iq = id timecat / SOLUTION;
LSMEANS ID TIMECAT;
RUN;
PROC MIXED;
CLASS timecat;
MODEL iq=timecat / SOLUTION;
RANDOM int / SUBJECT=id;
RUN;
TITLE 'Replication of Table 15.4';
PROC MIXED COVTEST CL;
CLASS timecat;
MODEL iq=timecat / SOLUTION;
RANDOM int time / SUBJECT=id TYPE=UN;
RUN;
TITLE 'Replication of Table 15.5';
PROC MIXED;
CLASS timecat;
MODEL iq=timecat / SOLUTION DDFM=SATTERTH;
RANDOM int time / SUBJECT=id TYPE=UN;
CONTRAST 'Time Main Effect' timecat 1 -1 0 0, 
timecat 0 1 -1 0, timecat 0 0 1 -1;
CONTRAST 'Time Linear' timecat -3 -1 1 3;
CONTRAST 'Time Quad' timecat 1 -1 -1 1;
CONTRAST 'Time Cubic' timecat -1 3 -3 1;
RUN;
TITLE 'Replication of Table 15.6';
PROC MIXED COVTEST CL;
MODEL iq=time / SOLUTION;
RANDOM int time / SUBJECT=id TYPE=UN GCORR;
RUN;
TITLE 'Replication of Table 15.10';
PROC MIXED; 
CLASS timecat;
MODEL iq=timecat / SOLUTION;
REPEATED / SUBJECT=id TYPE=un HLM HLPS RCORR;
RUN;
TITLE 'Replication of Table 15.11';
PROC MIXED;
CLASS timecat;
MODEL iq=timecat / SOLUTION;
REPEATED / SUBJECT=id TYPE=CS RCORR;
RUN;
TITLE 'Replication of Table 15.12';
PROC MIXED; 
CLASS timecat;
MODEL iq=timecat / SOLUTION;
REPEATED / SUBJECT=id TYPE=AR(1) RCORR;
RUN;



Back to chapter index

Chapter 16. Mixed-effects models for nested designs

Table 1 · Fitting a mixed model to the clinical trainee data

Download SAS program · Link to this example · Archived copy

*
chapter_16_table_1

We begin by revisiting the Clinical Trainee example from Table 10.9. 
However, we will now make use of PROC MIXED for the analyses. 

Because Chapter 15 provides all of the SAS syntax necessary to replicate
the results given in the chapter, and because explanations of the syntax
is also given in the text, most of the code given below is taken 
directly from the chapter without further elaborating on what was given
in the text.
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c16t1;
       SET md.chapter_16_table_1;
PROC MEANS MEAN;
BY gender;
CLASS trainee;
TYPES () trainee;
VAR severity;
RUN;

PROC MIXED;
CLASS trainee gender;
MODEL severity = gender / SOLUTION;
RANDOM trainee(gender) / SUBJECT=trainee(gender);
ESTIMATE 'Gender' gender 1 -1;
RUN;

PROC MIXED;
CLASS trainee gender;
MODEL severity = gender / SOLUTION;
RANDOM int / SUBJECT=trainee(gender);
ESTIMATE 'Gender' gender 1 -1;
RUN;

Table 4 · An inductive-reasoning intervention with children nested within classrooms

Download SAS program · Link to this example · Archived copy

*
chapter_16_table_4

The hypothetical data contained in Table 16.4 is supposed to represent
the data from 29 children who participated in a study to evaluate 
the effectiveness of an intervention designed to increase inductive 
reasoning skills. The data consists of children who are nested within
one of six classrooms, where each classroom contained students from
both the control and the experimental condition. The question of interest 
is whether or not the children who participated in the experimental 
group actually improved their cognitive reasoning ability.

Because Chapter 15 provides all of the SAS syntax necessary to replicate
the results given in the chapter, and because explanations of the syntax
is also given in the text, most of the code given below is taken 
directly from the chapter without explanations of the commands and 
optional specifications.
;

LIBNAME md 'd:\data files by type\sas data files\tables';
     Data c16t4;
       SET md.chapter_16_table_4_;
*The following line centers the cog variable by subtracting the mean
of the cog scores from the cog scores themselves. To avoid confusion
we rename the centered cog scores as cogcent;
cogcent = cog-49.7241379;

PROC MIXED;
CLASS room cond;
MODEL induct = cond / SOLUTION;
RANDOM int / SUBJECT=room(cond);
estimate 'Condition' cond -1 1;
RUN;

PROC MIXED;
CLASS room cond;
MODEL induct = cond skill / SOLUTION;
RANDOM int / SUBJECT=room(cond);
estimate 'Condition' cond -1 1;
RUN;

*Notice the TYPE=UN included in the PROC MIXED syntax below. Recall
TYPE=UN allows all of the the covariance parameters to be estimated.
In this case not only are the variances of the intercept and the 
slope for cogcent freely estimated, so too is the covariance between
them;
PROC MIXED;
CLASS room cond;
MODEL induct = cond cogcent cond*cogcent / SOLUTION;
RANDOM int cogcent / SUBJECT=room(cond) TYPE=UN;
estimate 'Condition' cond -1 1;
RUN;



Back to chapter index

SAS data files

Download all 144 SAS data files (ZIP)

Select a chapter for the data used in these examples. Choose an individual file or the complete ZIP. Both provide native .sas7bdat datasets. Older browsers use the original .sd7 or ZIP links. For current fourth-edition datasets, see Companion data.

Chapter 1

Table data
Table 1

Exercise data
Exercise 18 · Exercise 19 · Exercise 20 · Exercise 21 · Exercise 22 · Exercise 23

Chapter 3

Table data
Table 1 · Table 3 · Raw data for Table 7 · Raw data for Table 9

Exercise data
Exercise 9 · Exercise 10 · Exercise 11 · Exercise 19 · Exercise 20 · Exercise 21 · Exercise 22

Chapter 4

Table data
Table 1 · Table 7

Exercise data
Exercise 11 · Exercise 12 · Exercise 13 · Exercise 21

Chapter 5

Table data
Table 4

Exercise data
Exercise 5 · Exercise 10 · Exercise 16 · Exercise 23 · Exercise 24

Chapter 6

Table data
Table 1

Exercise data
Exercise 10 · Exercise 14 · Exercise 16

Chapter 7

Table data
Table 1 · Table 5 · Table 9 · Table 11 · Table 15 · Table 23

Exercise data
Exercise 6 · Exercise 9 · Exercise 12 · Exercise 13 · Exercise 14 · Exercise 15 · Exercise 18 · Exercise 19 · Exercise 21 · Exercise 22 · Exercise 23 · Exercise 24 · Exercise 25

Chapter 8

Table data
Table 12

Exercise data
Exercise 15 · Exercise 16 · Exercise 17 · Exercise 18 · Exercise 19

Chapter 9

Table data
Table 1 · Table 7 · Table 11 · Extension, Table 1 · Extension, Figures 4 and 5

Exercise data
Exercise 4 · Exercise 14 · Exercise 15 · Exercise 16 · Extension, Exercise 1 · Extension, Exercise 2 · Extension, Exercise 3

Chapter 10

Table data
Table 5 · Table 9

Exercise data
Exercise 7 · Exercise 9 · Exercise 14

Chapter 11

Table data
Table 1 · Table 4 · Table 5 · Table 19 · Table 20

Exercise data
Exercise 3 · Exercise 5 · Exercise 17 · Exercise 18 · Exercise 19 · Exercise 21 · Exercise 22 · Exercise 23 · Exercise 24

Chapter 12

Table data
Table 1 · Table 7 · Table 9 · Table 11 · Table 15 · Table 21

Exercise data
Exercise 9 · Exercise 17 · Exercise 18 · Exercise 19 · Exercise 21

Chapter 13

Table data
Table 1 · Table 2 · Table 6 (SAS dataset, ZIP) · Table 12 · Table 14

Exercise data
Exercise 7 · Exercise 10 · Exercise 13 · Exercise 14 · Exercise 22 · Exercise 23 · Exercise 24 · Exercise 25

Chapter 14

Table data
Table 1 · Table 3 · Table 4 · Table 5 · Table 8 · Table 10

Exercise data
Exercise 10 · Exercise 14 · Exercise 15 · Exercise 21 · Exercise 22

Chapter 15

Table data
Table 1

Exercise data
Exercise 16 · Exercise 17 · Exercise 18 · Exercise 18, Univariate · Exercise 19 · Exercise 19, Univariate

Chapter 16

Table data
Table 1 · Table 4

Exercise data
Exercise 5 · Exercise 7 · Exercise 9

Tutorial data

Data
Tutorial 1, Table 1 · Tutorial 2, Table 1 · Tutorial 2, Table 2 · Tutorial 3A, Table 1 · Tutorial 3A, Table 2 · Tutorial 3A, Table 4 · Tutorial 3A, Table 5

Scroll to Top