Programming the statistical procedures from SAS

Proc GLM contrast/estimate statement

Posts: 0

Proc GLM contrast/estimate statement

I have one continuous variable (X), a categorical variable (Z; treatment condition with three levels), and a continuous outcome variable (Z). X is an individual difference variable.

I have already figured out how to compare the different treatment conditions for different values of X. For example, for comparing treatment 1 and 2 among individuals scoring low on X (Mean of X at -1 SD = 4.2261), I would write the following:

proc glm;
class Z;
model y = Z X Z*X;
ESTIMATE 'Z 1 vs 2 at low X' Z -1 1 0 Z*X -4.2261 4.2261 0;

However, I can't figure out how to test whether individuals that score high versus low on X differ in Y, for each level of Z. (e.g., comparing Y scores for low and high X in treatment condition 1; comparing Y scores for low and high X in treatment condition 2 etc).

Any suggestions?
Regular Contributor
Posts: 169

Re: Proc GLM contrast/estimate statement

It usually helps to write out the ESTIMATE statement for each condition that you want to use in a contrast and then take the difference between the coefficients that are involved in that contrast. For instance, for treatment group 1, estimate statements for low and high X would be

estimate "Trt=1, low X"
  z     1 0 0
  x     -4.661
  z*x  -4.661 0 0;

estimate "Trt=1, high X"
  z     1 0 0
  x     4.661
  z*x  4.661 0 0;

The difference between these two is the effect of interest that you are having trouble constructing. But as presented above, the effect of interest would be:

estimate "Trt=1, high vs low X"
  x     9.322
  z*x  9.322 0 0;

Just change the label and the last line to reflect the different treatment conditions.
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation