Contributor
Posts: 45

# proc glm: estimate and contrast

Hi all,

I have the following SAS codes:

proc sort data=dataset1; by d1; run;

proc glm data=dataset1;
class f1 f2;
by d1;
model dep = indep1 indep2 f1 f2 /solution;
estimate 'test' indep1 1 -1 indep2 1 -1;
run; quit;

What I'm trying to do is a fixed effect regression, with f1 and f2 being the fixed effect, indep1 and indep2 being the independent variables. I also want to do the regression for two sub-samples: those with d1=1, and those with d1=0. d1 is a dummy variable that equals 1 for half the dataset, and 0 for the other half.

The output is two sets of regression results. One set is for those observations with d1=1, and the other for those with d1=0.

I want to test the following two hypotheses:

beta1 in group (d1=1)=beta1 in group (d1=0), beta1 being the coefficient of indep1;

beta2 in group (d1=1)=beta2 in group (d1=0), beta2 being the coefficient of indep2;

For each set of output, I got one 'test' results, with different t-values.

In the log file, I also got the error message " More coefficients than levels specified for effect indep1. Some coefficients will be ignored", " More coefficients than levels specified for effect indep2. Some coefficients will be ignored"

I'm just beginning to learn to use estimate and/or contrast statements. So below are my questions:

a. what is the difference between estimate and contrast statement? When should I use estimate, and when contrast?

b. How can I correctly test the following two hypotheses:

beta1 in group (d1=1)=beta1 in group (d1=0), beta1 being the coefficient of indep1;

beta2 in group (d1=1)=beta2 in group (d1=0), beta2 being the coefficient of indep2;

I've been googling a lot for this and didn't get the help I needed. So I'm hoping someone here could help me with this. Very much appreciated!

J

SAS Super FREQ
Posts: 3,839

Discussion stats