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 ttest 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 ttest 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:
 This first table provides means, standard deviation, min and max for each group and the mean difference.
 The next table provides 95% Confidence Limits on both the means and Standard Deviations, and the mean difference using both the pooled (assume variances are equal) and Satterthwaite (assume variances are not equal) methods.
 Before deciding the appropriate ttest we should look for if the variances for the two groups are equal. If the pvalue (Pr>F) is less than 0.05, you should assume UNEQUAL VARIANCES.
 Choose the Satterthwaite ttest, if we have unequal variance. If the variances were assumed equal, you would report the Pooled variances ttest.
 The last step is according to p value we get, we accept or reject the null.
 When you use the ODS GRAPHICS ON; option, we get graph which provides a visual comparison of the means (and distributions) of the two groups.
 Also we can see why the test for equality of variances equal or unequal.
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
PEOPLE ALSO READ

PotpourriJigsaw Academy is the #1 Analytics Training Institute in India

Articles“I Would Recommend This Course To Anyone Who’s Interested In Pursuing Business Analytics” – That’s What Our Learners Say!

ArticlesChannel Your Inner Business Analyst With The Right Upskilling Program

ArticlesAI needs Diversity to reduce Gender and Racial Bias!

ArticlesWhen Is The Best Time To Build A Career In Data Science You Ask? – We Say NOW!