# SAS: Goodness-of-fit Chi-Square Application: To test a hypothesis

SAS: Goodness-of-fit Chi-Square
Application: To test a hypothesis about the distribution of subjects across the categories of a single qualitative variable.
Research Hypothesis (it is often the case that the researcher’s hypothesis is the statistical null, something more
common for this statistical model than for most others): The researcher hypothesized that 3/4 of the stores would be Private, and
Chain and Coop stores would each make up 1/8 of the stores.
H0: The researcher hypothesized that 3/4 of the stores would be Private, and Chain and Coop stores would each make up 1/8 of the
stores.
PROC FORMAT;
VALUE chainf
1 = &quot;chain store&quot;
RUN;
 Proc Format is used to assign labels to data values
 give a name to the format
 list each data value and the corresponding label
LIBNAME stats &quot;C:\stats&quot;;
PROC FREQ DATA=stats.sasplay1;
FORMAT
chain chainf.;
TABLES chain
/CHISQ
NOCUM
TESTP=(.125 .75 .125);
RUN;
 specify the library name (path) for the data file
 call the data set using the library name
 specify the variable and the format for its value labels
 gets the frequency table for the variable
 gets gof Chi-square analysis
 keeps cumulative frequencies from being printed
 sets expected frequencies as proportions (TESTF sets as frequencies)
The p-value estimates
the probability that this
result is a Type I error.
Remember, even if
the printout shows it,
never report p =
.0000, because that
would suggest there is
no possibility of a
report “p &lt; .0001
Reporting the Results:
There were five Chain, three Private and four Coop stores.
This distribution was significantly different from the hypothesized
distribution that 75% of the stores would be private, and 12.5%
each would be coop and chain (X&sup2;(2)=16.33, p &lt; .0003).
It is important to show the category presenting
the Chi-square results.
As in the example, be sure to communicate:
 The research hypothesis (if there is one)
 The statistical results

Whether or not those results support the
research hypothesis
1