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


You can use the TINV function in SAS to find critical values from the t distribution.

This function uses the following basic syntax:

TINV(p, df)

where:

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

The following example shows how to use the TINV function to find the t critical value for a left-tailed test, right-tailed test, and a two-tailed test.

Example 1: Using TINV Function for Left-Tailed Test

Suppose we want to find the t critical value for a left-tailed test with a significance level of .05 and degrees of freedom = 22:

We can use the TINV function to calculate this value:

/*create dataset that contains t critical value*/
data my_data;
    critical_val=tinv(.05, 22);
    put critical_val=;
run;

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

The t critical value for a significance level of 0.05 and degrees of freedom = 22 is -1.71714.

Thus, if the test statistic is less than this value then the results of the test are statistically significant.

Example 2: Using TINV Function for Right-Tailed Test

Suppose we want to find the t critical value for a right-tailed test with a significance level of .05 and degrees of freedom = 22:

We can use the TINV function to calculate this value:

/*create dataset that contains t critical value*/
data my_data;
    critical_val=tinv(.95, 22);
    put critical_val=;
run;

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

The t critical value for a significance level of 0.05 and degrees of freedom = 22 is 1.71714.

Thus, if the test statistic is greater than this value then the results of the test are statistically significant.

Example 3: Using TINV Function for Two-Tailed Test

Suppose we want to find the t critical value for a two-tailed test with a significance level of .05 and degrees of freedom = 22:

We can use the TINV function to calculate this value:

/*create dataset that contains t critical value*/
data my_data;
    critical_val=tinv(.05/2, 22);
    put critical_val=;
run;

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

Whenever you perform a two-tailed test, there will be two critical values. In this case, the t critical values are -2.07387 and 2.07387.

Thus, if the test statistic is less than -2.0739 or greater than 2.0739 then the results of the test are statistically significant.

Additional Resources

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

How to Perform a One Sample t-Test in SAS
How to Perform a Two Sample t-Test in SAS
How to Perform a Paired Samples t-Test in SAS

Leave a Reply

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