How to Use the CINV Function in SAS (With Examples)


You can use the CINV function in SAS to find critical values from the Chi-Square distribution.

This function uses the following basic syntax:

CINV(p, df)

where:

  • p: 1 – the significance level
  • df: The degrees of freedom

The following example shows how to use the CINV function in practice to calculate Chi-Square critical values.

Example: How to Use CINV Function in SAS to Calculate Chi-Square Critical Values

Suppose we would like to find the Chi-Square critical value for a significance level of 0.05 and degrees of freedom = 11.

We can use the CINV function to calculate this value:

/*create dataset that contains Chi-Square critical value*/
data my_data;
    critical_val=cinv(.95, 11);
    put critical_val=;
run;

/*view results*/
proc print data=my_data; 

The Chi-Square critical value for a significance level of 0.05 and degrees of freedom = 11 is 19.67514.

Thus, if we’re conducting some type of Chi-Square test then we can compare the Chi-Square test statistic to 19.67514.

If the test statistic is greater than 19.67514, then the results of the test are statistically significant.

It’s worth noting that smaller values for the significance level will lead to larger Chi-Square critical values.

For example, consider the Chi-Square critical value for a significance level of 0.01, and degrees of freedom = 11:

/*create dataset that contains Chi-Square critical value*/
data my_data;
    critical_val=cinv(.99, 11);
    put critical_val=;
run;

/*view results*/
proc print data=my_data; 

The Chi-Square critical value for a significance level of 0.01 and degrees of freedom = 11 is 24.7250.

Note: You can also use the Chi-Square distribution table to find critical values by hand. The values that you find in the table will match the ones calculated by the CINV function in SAS.

Additional Resources

The following tutorials explain how to perform other common tasks in SAS:

How to Perform a Chi-Square Test of Independence in SAS
How to Perform a Chi-Square Goodness of Fit Test in SAS

Leave a Reply

Your email address will not be published. Required fields are marked *