Published on :
Statistics INTERNAL_CREATION

Multiple-Population Repeated Measures with PROC CATMOD

This code is also available in: Deutsch Español Français
Awaiting validation
This script illustrates the use of the CATMOD procedure to analyze binary responses (0 or 1) recorded during four successive trials on subjects from three different groups. It performs a repeated measures analysis by first fitting a saturated model on marginal probabilities, then a model with nested effects.
Data Analysis

Type : INTERNAL_CREATION


Data is generated directly within the script via the DATALINES statement. The INPUT statement uses the '@@' operator to read multiple observations per line.

1 Code Block
DATA STEP Data
Explanation :
Creation of the 'group' dataset. Variables a, b, c, d represent responses to 4 trials. 'Group' is the group identifier and 'wt' is the weighting (frequency). The '@@' operator allows reading multiple observations on a single physical line.
Copied!
1DATA group;
2 INPUT a b c d Group wt @code_sas_json/8_SAS_Intro_ReadFile_MultiCol_@@.json;
3 DATALINES;
41 1 1 1 2 2 0 0 0 0 2 2 0 0 1 0 1 2 0 0 1 0 2 2
50 0 0 1 1 4 0 0 0 1 2 1 0 0 0 1 3 3 1 0 0 1 2 1
60 0 1 1 1 1 0 0 1 1 2 2 0 0 1 1 3 5 0 1 0 0 1 4
70 1 0 0 2 1 0 1 0 1 2 1 0 1 0 1 3 2 0 1 1 0 3 1
81 0 0 0 1 3 1 0 0 0 2 1 0 1 1 1 2 1 0 1 1 1 3 2
91 0 1 0 1 1 1 0 1 1 2 1 1 0 1 1 3 2
10;
2 Code Block
PROC CATMOD
Explanation :
Execution of PROC CATMOD. The first part fits a saturated model for repeated measures (defined by 'repeated Trial 4') on marginal probabilities. The second MODEL statement (interactive mode) tests a specific structure where the effect of trials is nested within group 3.
Copied!
1title 'Multiple-Population Repeated Measures';
2PROC CATMOD DATA=group;
3 weight wt;
4 response marginals;
5 model a*b*c*d=Group _response_ Group*_response_
6 / freq;
7 repeated Trial 4;
8 title2 'Saturated Model';
9RUN;
10 
11 model a*b*c*d=Group _response_(Group=3)
12 / noprofile noparm design;
13 title2 'Trial Nested within Group 3';
14QUIT;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : SAS SAMPLE LIBRARY, SAS/STAT User's Guide