0% found this document useful (0 votes)
30 views3 pages

Syntax: FREQ Along With The Option Chisq To Determine The Result of Chi-Square

A chi-square test examines the association between two categorical variables and can test for dependence or independence. PROC FREQ in SAS is used to run a chi-square test, where the TABLES statement specifies the variables and the CHISQ option requests the test. The basic syntax includes the DATA, TABLES, and CHISQ statements. A chi-square test example is shown using the type variable from SASHELP.CARS, assigning percentages to each level. A two-way chi-square also examines the relationship between two variables, shown using the type and origin variables.

Uploaded by

prakash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views3 pages

Syntax: FREQ Along With The Option Chisq To Determine The Result of Chi-Square

A chi-square test examines the association between two categorical variables and can test for dependence or independence. PROC FREQ in SAS is used to run a chi-square test, where the TABLES statement specifies the variables and the CHISQ option requests the test. The basic syntax includes the DATA, TABLES, and CHISQ statements. A chi-square test example is shown using the type variable from SASHELP.CARS, assigning percentages to each level. A two-way chi-square also examines the relationship between two variables, shown using the type and origin variables.

Uploaded by

prakash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

A chi-square test is used to examine the association between two

categorical variables. It can be used to test both extent of dependence


and extent of independence between Variables. SAS uses PROC
FREQ along with the option chisq to determine the result of Chi-Square
test.

Syntax
The basic syntax for applying PROC FREQ for Chi-Square test in SAS is:
PROC FREQ DATA = dataset;
TABLES variables
/CHISQ TESTP=(percentage values);

Following is the description of the parameters used:

Dataset is the name of the dataset.

Variables are the variable names of the dataset use in chi-square test.

Percentage Values in the TESTP statement represent the percentage of levels of the
variable.

Example
In the below example we consider a chi-square test on the variable
named type in the dataset SASHELP.CARS. This variable has six levels
and we assign percentage to each level as per the design of the test.
proc freq data = sashelp.cars;
tables type
/chisq
testp=(0.20 0.12 0.18 0.10 0.25 0.15);
run;

When the above code is executed, we get the following result:

We also get the bar chart showing the deviation of the variable type as
shown below.

Two Way chi-square


Two way Chi-Square test is used when we apply the tests to two
variables of the dataset.

Example
In the below example we apply chi-square test on two variables named
type and origin. The result shows the tabular form of all combinations of
these two variables.
proc freq data = sashelp.cars;
tables type*origin
/chisq
;

You might also like