Table of Contents
The One Sample t-Test is a statistical tool used to determine if the mean of a single sample is significantly different from a known or hypothesized population mean. In order to perform this test in SAS, the following steps should be followed:
1. Define the research question and select the appropriate variables from the dataset.
2. Use the PROC TTEST procedure in SAS to specify the one sample t-test.
3. Specify the variables for the analysis and the population mean to be tested against.
4. Choose the appropriate test options such as confidence level and type of t-test (one-tailed or two-tailed).
5. Run the t-test and interpret the results, including the p-value and confidence interval.
It is important to ensure that the assumptions of the one sample t-test are met, such as normality and independence, before interpreting the results. By following these steps, one can effectively perform a One Sample t-Test in SAS and make informed conclusions about the mean of a single sample.
Perform a One Sample t-Test in SAS
A one sample t-test is used to determine whether or not the mean of a is equal to some value.
This tutorial explains how to perform a one sample t-test in SAS.
Example: One Sample t-Test in SAS
Suppose a botanist wants to know if the mean height of a certain species of plant is equal to 15 inches. She collects a of 12 plants and records each of their heights in inches.
The heights are as follows: 14, 14, 16, 13, 12, 17, 15, 14, 15, 13, 15, 14
Use the following steps to conduct a one sample t-test to determine if the mean height for this species of plant is actually equal to 15 inches.
Step 1: Create the data.
First, we’ll use the following code to create the dataset in SAS:
/*create dataset*/ data my_data; input Height; datalines; 14 14 16 13 12 17 15 14 15 13 15 14 ; run; /*print dataset*/ proc printdata=my_data;

Step 2: Perform a one sample t-test.
Next, we’ll use proc ttest to perform the one sample t-test:
/*perform one sample t-test*/ proc ttestdata=my_data sides=2alpha=0.05h0=15; var Height; run;

The first table displays descriptive statistics for our sample, including:
- N (total observations): 12
- Mean (sample mean): 14.3333
- Std Dev (sample standard deviation): 1.3707
- Std Error (standard error, calculated as s/√n): .3957
- Minimum (the minimum value): 12
- Maximum (the maximum value) 17
The second table displays the 95% for the true population mean:
- 95% C.I. for μ: [13.4624, 15.2042]
The third table displays the t test statistic and corresponding p-value:
- t test statistic: -1.68
- p-value: 0.1201
Note: The t test statistic was calculated as:
- t test statistic = (x – μ) / (s/√n)
- t test statistic = (14.3333-15) / (1.3707/√12)
- t test statistic = -1.68
Recall that the one sample t-test uses the following null and alternative hypotheses:
- H0: μ = 15 inches
- HA: μ ≠ 15 inches
Since the p-value (.1201) is not less than .05, we fail to reject the null hypothesis.
This means we do not have sufficient evidence to say that the mean height of this certain species of plant is different than 15 inches.
Additional Resources
The following tutorials explain how to perform other common statistical tests in SAS:
Cite this article
stats writer (2024). How do you perform a One Sample t-Test in SAS?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-do-you-perform-a-one-sample-t-test-in-sas/
stats writer. "How do you perform a One Sample t-Test in SAS?." PSYCHOLOGICAL SCALES, 1 Jul. 2024, https://scales.arabpsychology.com/stats/how-do-you-perform-a-one-sample-t-test-in-sas/.
stats writer. "How do you perform a One Sample t-Test in SAS?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-do-you-perform-a-one-sample-t-test-in-sas/.
stats writer (2024) 'How do you perform a One Sample t-Test in SAS?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-do-you-perform-a-one-sample-t-test-in-sas/.
[1] stats writer, "How do you perform a One Sample t-Test in SAS?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, July, 2024.
stats writer. How do you perform a One Sample t-Test in SAS?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
