Question

In: Statistics and Probability

In statistics, how do you test independence using SAS programming?

In statistics, how do you test independence using SAS programming?

Solutions

Expert Solution

In SAS we test independence using chi square test for independence for this we consider following procedure,

Theory

1) 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.

2) in SAS we use 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 in the following screenshot.

Two Way chi-square

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

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 
;
run;

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

Hence, in this manner we perform Chi square test for independence in SAS so we get answer very easily.

Hi Dear,
I have given my 100% to solve your problem.
So, please help me out by just thumbs up.
Thank you, so much.


Related Solutions

Using SAS programming Please include the syntax and output of the information: In a study of...
Using SAS programming Please include the syntax and output of the information: In a study of factors thought to be responsible for the adverse effects of smoking on human reproduction, cadmium level determinations (nanograms per gram) were made on placenta tissue of a sample of 14 mothers who were smokers and an independent random sample of 18 nonsmoking mothers. The results were as follows- Nonsmokers: 10.0, 8.4, 12.8, 25.0, 11.8, 9.8, 12.5, 15.4, 23.5, 9.4, 25.1, 19.5, 25.5, 9.8, 7.5,...
Using SAS programming Please include the syntax and output of the information: In a study of...
Using SAS programming Please include the syntax and output of the information: In a study of factors thought to be responsible for the adverse effects of smoking on human reproduction, cadmium level determinations (nanograms per gram) were made on placenta tissue of a sample of 14 mothers who were smokers and an independent random sample of 18 nonsmoking mothers. The results were as follows- Nonsmokers: 10.0, 8.4, 12.8, 25.0, 11.8, 9.8, 12.5, 15.4, 23.5, 9.4, 25.1, 19.5, 25.5, 9.8, 7.5,...
You have been using the chi-square test of independence to test for association between two variables....
You have been using the chi-square test of independence to test for association between two variables. 1) Give an example of a pair of variables for which you would expect to find no association. 2) Give an example of a pair of variables for which you would expect to find association, but not a causal relationship. 3) Finally, give an example of a pair of variables for which you would expect to find a causal relationship.
How to make a declie plot by using SAS?  
How to make a declie plot by using SAS?  
Bonus Using permutation test SAS code , do the following: Trauma data Metabolic Expenditure Nontrauma patients:...
Bonus Using permutation test SAS code , do the following: Trauma data Metabolic Expenditure Nontrauma patients: 20.1 22.9 18.8 20.9 20.9 22.7 21.4 20 trauma patients: 38.5 25.8 22 23 37.6 30 24.5 Part A Build the permutation distribution (using 5,000 permutations) for the rank sum statistic for the Trauma data used above. Use SAS to fit/overlay a normal curve to the resulting histogram. Compare the mean and standard deviation of this normal curve that was fit to the permutation/randomization...
how does this relate to the requirement of independence in a binomial experiment? how do you...
how does this relate to the requirement of independence in a binomial experiment? how do you write a probability in english?
You are conducting a test of independence for the claim that there is an association between...
You are conducting a test of independence for the claim that there is an association between the row variable and the column variable. X Y Z A 27 19 8 B 42 25 29 What is the chi-square test-statistic for this data? χ2= Report all answers accurate to three decimal places. You are conducting a test of the claim that the row variable and the column variable are dependent in the following contingency table. X Y Z A 43 45...
How can Chi Square test for independence be used to evaluate test re-test reliability?
How can Chi Square test for independence be used to evaluate test re-test reliability?
Using c programming language How do you put data from a text file into a 2d...
Using c programming language How do you put data from a text file into a 2d array For example a text file with names and age: john 65 sam 34 joe 35 sarah 19 jason 18 max 14 kevin 50 pam 17 bailey 38 one 2d array should have all the names from the file and one 2d array should have all the ages and both arrays should be printed out separately and be 3x3
How are the expected values calculated for the contingency table of a test if independence and...
How are the expected values calculated for the contingency table of a test if independence and what is the reason that this formula works?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT