Published on :
Statistics INTERNAL_CREATION

Introduction to PROC GLIMMIX Example: Logistic Regression

This code is also available in: Deutsch Español Français
Awaiting validation
This script comes from the SAS© sample library. It illustrates the use of the GLIMMIX procedure to fit a generalized linear mixed model (GLMM) on binomial data. The objective is to model the proportion of side effects as a function of the treatment group, while accounting for variability between different centers (random intercept by subject/center).
Data Analysis

Type : INTERNAL_CREATION


Data is statically generated in the script via the DATA step 'multicenter' and the DATALINES statement.

1 Code Block
DATA STEP Data
Explanation :
Creation of the 'multicenter' dataset containing study results: center, treatment group, total number of patients (n), and observed number of side effects.
Copied!
1DATA multicenter;
2 INPUT center group$ n sideeffect;
3 DATALINES;
4 1 A 32 14
5 1 B 33 18
6 2 A 30 4
7 2 B 28 8
8 3 A 23 14
9 3 B 24 9
10 4 A 22 7
11 4 B 22 10
12 5 A 20 6
13 5 B 21 12
14 6 A 19 1
15 6 B 20 3
16 7 A 17 2
17 7 B 17 6
18 8 A 16 7
19 8 B 15 9
20 9 A 13 1
21 9 B 14 5
2210 A 13 3
2310 B 13 1
2411 A 11 1
2511 B 12 2
2612 A 10 1
2712 B 9 0
2813 A 9 2
2913 B 9 6
3014 A 8 1
3114 B 8 1
3215 A 7 1
3315 B 8 0
34;
2 Code Block
PROC GLIMMIX
Explanation :
Execution of the GLIMMIX procedure. The model specifies a binomial distribution (events/trials syntax) with 'group' as a fixed effect. A random intercept is added for each 'center' to capture intra-center correlation.
Copied!
1PROC GLIMMIX DATA=multicenter;
2 class center group;
3 model sideeffect/n = group / solution;
4 random intercept / subject=center;
5RUN;
3 Code Block
PROC GLIMMIX
Explanation :
Second execution identical to the first, but focused on displaying least squares means (LS-means). The 'ilink' option is used to report estimates on the scale of the original data (probabilities) rather than on the link scale (logit).
Copied!
1ods select lsmeans;
2PROC GLIMMIX DATA=multicenter;
3 class center group;
4 model sideeffect/n = group / solution;
5 random intercept / subject=center;
6 lsmeans group / cl ilink;
7RUN;
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 / NAME: gmxgs1 / PRODUCT: STAT