UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

SAS FAQ
How can I compute omega squared in SAS after proc glm?

After you perform an ANOVA using proc glm, it is useful to be able to report omega squared as a measure of the strength of the effect of the independent variable.  Proc glm currently does not have an option that computes this. Here is an example that shows how to compute ω2 . The formula for ω2 given below is based on the formula on page 178 of  Kirk's Experimental Design  using the F-statistic.

omega^2 = df*(F-1)/(df*(F-1)+N),

where F is the F-statistic, df is the degrees of freedom of the model and N is the total number of observations.

proc glm data = in.hsb2;
  class race ses;
  model write = race ses/ss3;
  ods output overallanova = atable;
run;
quit;
Dependent Variable: WRITE   writing score                                        Sum of
Source                      DF         Squares     Mean Square    F Value    Pr > F
Model                        5      2429.84904       485.96981       6.10    <.0001
Error                      194     15449.02596        79.63415
Corrected Total            199     17878.87500
We used an ODS output statement to output the ANOVA table to a data set called atable
proc print data = atable noobs;
run;
Dependent    Source                 DF              SS              MS     FValue     ProbF
  WRITE      Model                   5      2429.84904       485.96981       6.10    <.0001
  WRITE      Error                 194     15449.02596        79.63415        _       _
  WRITE      Corrected Total       199     17878.87500          _             _       _
The F-statistic is 6.10 and there are five degrees of freedom. The total number of observations is the corrected total + 1. The calculation of omega squared is performed in the data step below. We also calculated the f-hat measure of effect size. The f-hat measure of effect size is related to omega-squared as follows:

f-hat = sqrt (omega&2/(1-omega^2)). 

data _omega2_;
  set atable nobs = last;
  retain fv p;
  if source = "Model" then do ;
  p = df;
  fv = fvalue - 1;
  end;
  if source = "Corrected Total" then 
  do;
  omega2 = p*fv/(p*fv + df + 1);
  esize = sqrt(omega2/(1-omega2));
  end;
  if _n_ = last;
  keep omega2 esize;
run;
proc print data = _omega2_ noobs;
run;
 omega2     esize
0.11313    0.35716

How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California