🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Fluorite | Level 6

## Sum of squares is equal to zero while using proc glm, mixed

Hi,

while running scores data in proc glm, i got zero value for the sum of squares (variable - site, levels L and R ).

is it obvious? i've tried searching internet and found nothing.

i think here there is no problem with the code i've used.

proc glm data=one(where=(hour ne 0));
class subject hour Site;
model score = subject site hour/ ss3;
lsmeans hour /stderr pdiff;
run;

any statistical explanations?

1 ACCEPTED SOLUTION

Accepted Solutions
SAS Super FREQ

## Re: Sum of squares is equal to zero while using proc glm, mixed

The most likely explanation is that the subjects are nested within sites, so that there are no degrees of freedom for the Site variable. For example look at this simulated data and results:

``````data one;
do subject = 1 to 54;
if subject < 5 then Site=1;
else Site=2;
do hour=1 to 2;
score = site + hour + rand("normal");
output;
end;
end;
run;

ods select ModelANOVA;
proc glm data=one;
class subject hour Site;
model score = subject site hour/ ss3;
lsmeans hour /stderr pdiff;
run;
quit;``````
6 REPLIES 6
PROC Star

## Re: Sum of squares is equal to zero while using proc glm, mixed

Presumable SITE is constant in your subsample.  Consider the same results for SEX below:

proc glm data=sashelp.class (where=(sex='F'));

class age sex;

model height=age sex /ss3;

run;

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Fluorite | Level 6

## Re: Sum of squares is equal to zero while using proc glm, mixed

here in your code, you are using only one level in variable SEX ie 'F'. so, there is no way for the calculation of SS but in my code i'm using two levels for the variable SITE. in DF column it should have show me 1 instead of zero that you can see in the above attached .jpg file.
Jade | Level 19

## Re: Sum of squares is equal to zero while using proc glm, mixed

Consider what @mkeintz said, and run a crosstab on site and hour.  I would suggest that one of the sites has all of the hour variables coded in such a way that the where= clause is excluding everything.

Although the results are probably uninteresting for your research problem, what happens when you run the following?

``````proc glm data=one;
class subject hour Site;
model score = subject site hour/ ss3;
lsmeans hour /stderr pdiff;
run;``````

Steve Denham

SAS Super FREQ

## Re: Sum of squares is equal to zero while using proc glm, mixed

The most likely explanation is that the subjects are nested within sites, so that there are no degrees of freedom for the Site variable. For example look at this simulated data and results:

``````data one;
do subject = 1 to 54;
if subject < 5 then Site=1;
else Site=2;
do hour=1 to 2;
score = site + hour + rand("normal");
output;
end;
end;
run;

ods select ModelANOVA;
proc glm data=one;
class subject hour Site;
model score = subject site hour/ ss3;
lsmeans hour /stderr pdiff;
run;
quit;``````
Jade | Level 19

## Re: Sum of squares is equal to zero while using proc glm, mixed

/Homer Simpson voice on

D'oh!

/Homer off

Good point, @Rick_SAS.  Much more likely than my guess.

Steve Denham

Fluorite | Level 6

## Re: Sum of squares is equal to zero while using proc glm, mixed

Thanks for the replies. like Rick_SAS said subjects are nested within the sites in my data.
Discussion stats
• 6 replies
• 2029 views
• 5 likes
• 4 in conversation