This post has been written by Jigsaw Faculty Kafeel Basha
Let me begin this article by explaining exactly what a t- test is. I will then explain when we can use the t- test and then go on to tell you all about the procedure we can use to perform the t- test using the language of SAS.
Well, a t-test is a statistical significance that indicates whether or not the difference between two sample means, most likely reflects a real difference in the population from which the groups were sampled. In simple words, t- test is used to find the mean difference between population mean and sample mean.
When can we apply t- test?
We can apply the t- test when we have a sample size n<30, population mean, sample mean and sample standard deviation.
Procedure used to perform t- test in sas: Proc ttest
Type t- test using SAS
SAS Code for t- test: One sample
Syntax
proc ttest data=name;
var <Option>
run;
Where “name” is the data set name used for the test and “<Option>” gives the variables used for the t test ie “option=variable name” where the sample data is stored. Each variable that was listed on the var statement will have its own line in this part of the output. If a var statement is not specified, proc ttest will conduct a t-test on all numerical variables in the dataset.
SAS Code for t- test: Two sample (Independent Sample)
Syntax
proc ttest data=name;
class <Option>;
var <Option>;
run;
Here class statement subgroup the two different sample and we have to specify the variable name where the observation for both the samples are stored.
Note: We have to arrange the data before performing two sample test.
(Example given, Where X and Y are two samples for T test)
SAS Codes for T test: Paired (Dependent Sample)
Syntax
proc ttest data=name;
Paired v1*v2;
run;
Where v1 and v2 are the dependent variables.
Output of T test:
Note: For paired t test Pooled and Satterthwaite methods are not required as the variables are dependent.
Related Articles:
Logistic Regression in SAS
5 Popular Tools for Data Visualization
Understanding Dummy Variable Traps in Regression
Popular Applications of Linear Regression for Businesses