This example uses PROC TRANSREG and the DESIGN
o-option to prepare an input data set with classification variables for the LOGISTIC procedure. The DESIGN o-option specifies that the goal is design matrix creation, not analysis. When you specify DESIGN, dependent variables are not required.
The DEVIATIONS
(or EFFECTS
) t-option requests a deviations-from-means coding of the classification variables, which is the same coding the CATMOD procedure uses. PROC TRANSREG automatically creates
a macro variable &_TrgInd
that contains the list of independent variables created. This macro is used in the PROC LOGISTIC MODEL statement. (See Figure 117.75.) For comparison, the same analysis is also performed with PROC CATMOD. The following statements create Figure 117.75:
title 'Using PROC TRANSREG to Create a Design Matrix'; data a; do y = 1, 2; do a = 1 to 4; do b = 1 to 3; w = ceil(uniform(1) * 10 + 10); output; end; end; end; run; proc transreg data=a design; model class(a b / deviations); id y w; output out=coded; run; proc print; title2 'PROC TRANSREG Output Data Set'; run; title2 'PROC LOGISTIC with Classification Variables'; proc logistic; freq w; model y = &_trgind; run; title2 'PROC CATMOD Should Produce the Same Results'; proc catmod data=a; model y = a b; weight w; run;
Figure 117.75: The PROC TRANSREG Design Matrix
Analysis of Maximum Likelihood Estimates | |||||
---|---|---|---|---|---|
Parameter | DF | Estimate | Standard Error |
Wald Chi-Square |
Pr > ChiSq |
Intercept | 1 | -0.00040 | 0.1044 | 0.0000 | 0.9969 |
a1 | 1 | -0.0802 | 0.1791 | 0.2007 | 0.6542 |
a2 | 1 | 0.2001 | 0.1800 | 1.2363 | 0.2662 |
a3 | 1 | -0.1350 | 0.1819 | 0.5514 | 0.4578 |
b1 | 1 | -0.2392 | 0.1500 | 2.5436 | 0.1107 |
b2 | 1 | 0.3433 | 0.1474 | 5.4223 | 0.0199 |