This page shows you how to run the common tests in SAS, which table in the output actually matters, and how to write the result in APA. When the deadline is tight or the data will not behave, a statistician can write the program and interpret it on your own dataset.
SAS is less about clicking buttons than knowing which procedure to call and what the output means. Pick the wrong PROC for the design, skip the assumption checks, or read the wrong table, and the analysis is wrong no matter how tidy the code looks. This guide is part of our statistics homework help. It gives the exact PROC code for each common test, points at the one table in the output that decides the result, and shows how to report it. Where a test can fail, it names the check and the fallback procedure to use instead.
Two things that trip people up in SAS. First, every DATA step and every PROC step must end with a RUN; statement, and a missing semicolon is the most common reason a program stalls. Second, SAS does not choose the equal-variance assumption for you: PROC TTEST prints both a Pooled row and a Satterthwaite row, and you decide which one to read from the Equality of Variances test in the same output.
Match your research question and variable types to the right procedure, then jump to its guide.
| Your question | Your data | Test |
|---|---|---|
| Do two unrelated groups differ on average? | Continuous outcome, two independent groups | Independent-samples t-test |
| Did the same people change between two points? | Continuous outcome, two paired measures | Paired-samples t-test |
| Do three or more unrelated groups differ? | Continuous outcome, three or more groups | One-way ANOVA |
| Are two categories associated? | Two categorical variables | Chi-square test of independence |
| Do two continuous variables move together? | Two continuous variables | Pearson correlation |
Not sure your data meets the requirements? Every guide below lists the assumptions and the procedure to switch to when one fails.
A SAS program is a sequence of steps, and each one is either a DATA step or a PROC step. The DATA step reads, builds and edits a dataset one row at a time. The PROC step runs a ready-made procedure, such as PROC TTEST or PROC FREQ, on a dataset that already exists. In short, the DATA step prepares the data and the PROC step analyses it. Both kinds of step end with a RUN; statement.
Reading data in. For a small dataset typed into the program, use a DATA step with an INPUT statement and inline DATALINES. For an external file such as a spreadsheet or CSV, use PROC IMPORT, which reads the file and creates a SAS dataset for you.
Notice the dollar sign after group in the INPUT statement. That tells SAS the variable is character, not numeric, which is how you flag a grouping variable such as treatment or gender. Leave it off for continuous measures.
The three windows. When a program runs, SAS uses three places to show you what happened. The Log reports what SAS did, including notes, warnings and errors, and it is the first place to look when nothing appears. The Output, also called the Results Viewer, holds the tables and plots the procedures produced. The Results panel is an index of those tables so you can jump to the one you want. Always read the Log before you trust the Output: a result printed from the wrong dataset still looks perfectly tidy.
The PROC code, the assumption checks, the exact table to read, and how to report it. Example values follow standard teaching datasets.
Compares the means of one continuous outcome across two unrelated groups, for example a test score under two teaching methods.
Assumptions. Continuous outcome, two independent groups, no serious outliers, approximate normality within each group, and equal variances. SAS tests normality if you add PROC UNIVARIATE with the NORMAL option, and it tests equal variances inside the TTEST output with the Folded F Equality of Variances test. If normality is badly broken, switch to the Wilcoxon rank-sum test with PROC NPAR1WAY WILCOXON; CLASS group; VAR y; RUN;.
What to read, and the Pooled versus Satterthwaite rule. Read the Equality of Variances table first. If its Pr > F is above .05 the variances are equal, so read the Pooled row of the T-Tests table. If its Pr > F is .05 or below the variances are unequal, so read the Satterthwaite row instead. On the chosen row read t Value, DF, and Pr > |t|.
| group | N | Mean | Std Dev | Std Err |
|---|---|---|---|---|
| A | 20 | 78.5 | 8.20 | 1.83 |
| B | 20 | 72.3 | 9.10 | 2.03 |
| Method | Num DF | Den DF | F Value | Pr > F |
|---|---|---|---|---|
| Folded F | 19 | 19 | 1.23 | .646 |
| Method | Variances | DF | t Value | Pr > |t| |
|---|---|---|---|---|
| Pooled | Equal | 38 | 2.27 | .029 |
| Satterthwaite | Unequal | 37.6 | 2.27 | .029 |
Common mistakes
Equality of Variances failing, outliers, or a non-normal outcome on your own dataset? Our statisticians will run the correct version and interpret it. Get a quote →
Compares two measurements taken on the same people, for example a score before and after training.
Assumptions. A continuous outcome measured twice on the same cases, no serious outliers, and normality of the difference scores, not the raw variables. Create the difference in a DATA step and check it with PROC UNIVARIATE NORMAL PLOT. If the differences are badly non-normal, use the Wilcoxon signed-rank test, which PROC UNIVARIATE reports in its Tests for Location table under Signed Rank.
What to read. The T-Tests table, reading across to t Value, DF, which equals the number of pairs minus one, and Pr > |t|. The Statistics table above it gives the mean difference and its standard deviation.
| N | Mean | Std Dev | Std Err |
|---|---|---|---|
| 15 | -3.40 | 2.80 | 0.72 |
| DF | t Value | Pr > |t| |
|---|---|---|
| 14 | -4.70 | <.0001 |
Common mistakes
Compares the means of one continuous outcome across three or more unrelated groups.
PROC ANOVA or PROC GLM. Both give the same F test for a balanced one-way design, so either works when every group has the same number of observations. PROC GLM is the safer default because it handles unequal group sizes and covariates correctly, while PROC ANOVA assumes a balanced design. When you are unsure, use PROC GLM.
Assumptions. Continuous outcome, three or more independent groups, no serious outliers, normality within groups, and equal variances (the HOVTEST option runs Levene's test). If the variances are unequal, add a WELCH option to the MEANS statement for the Welch ANOVA. If normality is badly broken, use the Kruskal-Wallis test with PROC NPAR1WAY WILCOXON; CLASS group; VAR y; RUN;.
What to read. The Model row of the ANOVA table for F Value and Pr > F. Then the Tukey grouping table, where means that share a letter do not differ significantly and means with different letters do.
| Source | DF | Sum of Squares | Mean Square | F Value | Pr > F |
|---|---|---|---|---|---|
| Model | 2 | 85.5 | 42.75 | 4.47 | .021 |
| Error | 27 | 258.3 | 9.57 | ||
| Corrected Total | 29 | 343.8 |
Common mistakes
Unbalanced groups, a failed variance test, or a Tukey table you cannot read? Send your file and we will run it and write the result. Get a quote →
Tests whether two categorical variables are associated, for example gender and a preferred learning format.
Assumptions. Both variables categorical, independent observations, and expected counts large enough: no more than 20 percent of cells may have an expected count below five. The EXPECTED option prints the expected counts, and SAS adds a warning under the table when the rule fails. In a two-by-two table where it fails, read Fisher's Exact Test, which the CHISQ option prints automatically. For paired categorical data on the same people, use McNemar's test with the AGREE option instead.
What to read. The Statistics for Table block, the Chi-Square row, which is the Pearson chi-square. Ignore the Likelihood Ratio and Mantel-Haenszel rows.
| Statistic | DF | Value | Prob |
|---|---|---|---|
| Chi-Square | 1 | 0.487 | .485 |
| Likelihood Ratio Chi-Square | 1 | 0.488 | .485 |
| Sample Size = 50 |
Common mistakes
Measures the strength and direction of the linear relationship between two continuous variables.
Assumptions. Two continuous variables, a linear relationship and no serious outliers, both checked on a scatterplot before you trust the coefficient, and approximate normality. Add the PLOTS=SCATTER option to draw it. Pearson only captures linear association, so a strong curved relationship can still return a small r. For ordinal data or a monotonic but non-linear relationship, use Spearman with PROC CORR SPEARMAN; VAR x y; RUN;.
What to read. The Pearson Correlation Coefficients matrix. Read an off-diagonal cell: the top number is r, from minus one to plus one, the number below it is the p-value under the null that the correlation is zero, and N is the number of complete pairs.
| x | y | |
|---|---|---|
| x | 1.000 | 0.706 .0047 |
| y | 0.706 .0047 | 1.000 |
Common mistakes
Most SAS marks are lost not on the code but on ignoring a broken assumption. Check the assumption, and when it fails, switch to the matched procedure rather than reporting an invalid result.
| Assumption | How SAS checks it | If it fails |
|---|---|---|
| Normality | PROC UNIVARIATE with the NORMAL option, plus Q-Q plots | Use the non-parametric equivalent: PROC NPAR1WAY WILCOXON, or the Signed Rank test in PROC UNIVARIATE for paired data |
| Equal variances (two groups) | Folded F Equality of Variances test in PROC TTEST | Read the Satterthwaite row |
| Equal variances (three or more groups) | HOVTEST (Levene) on the MEANS statement | Add the WELCH option for Welch's ANOVA |
| Expected cell counts | EXPECTED option warning under PROC FREQ | Use Fisher's Exact Test |
| Linearity | Scatterplot from PROC CORR PLOTS=SCATTER or PROC SGPLOT | Use PROC CORR SPEARMAN |
Procedures on this page were checked against the SAS/STAT TTEST procedure documentation and the UCLA OARC SAS statistical computing guides.
When the data will not behave, an assumption fails, or the deadline is unforgiving, a specialist writes the SAS program, runs it on your dataset, and explains the output so you can defend it. This is done-with-you help: you get the code and the reasoning, not just an answer.
Upload your dataset, the assignment brief and your deadline, then get a free quote from support.
Approve the price and a statistician who writes SAS every day starts right away.
Get the program, output, interpretation and write-up in your account, with free revisions if you need them.
Your work goes to a specialist who passed a subject-specific statistics test and a background check, and who writes SAS every day. What we deliver is a model answer and study aid for reference, and many students use it to learn the method and check their own analysis.
Everything stays private. Your data and details are confidential, we never contact your school, payments are secure, and the work is original and plagiarism-checked.
Get SAS help you can trust →"Without these guys there is no way I would have graduated. Am particularly happy with Moses for all the help he offered. Thanks man! Be blessed."
"Such great customer service and really helped out when I was in a jam for time and made awesome grades. Thank you so much."
Use PROC TTEST. For two independent groups write PROC TTEST; CLASS group; VAR y; RUN;. SAS prints a Statistics table, a T-Tests table with the Pooled and Satterthwaite rows, and an Equality of Variances table. Read the Equality of Variances p-value first, then read the Pooled row if the variances are equal or the Satterthwaite row if they are not. For a before-and-after design on the same subjects use PROC TTEST; PAIRED before*after; RUN; instead.
Both fit an analysis of variance and give the same F test for a balanced one-way design, so either works when every group has the same number of observations. PROC GLM is the safer default because it handles unbalanced groups, unequal cell sizes and covariates correctly, while PROC ANOVA assumes a balanced design. When you are unsure, use PROC GLM.
Read the Equality of Variances table first. If its Pr > F is above 0.05 the variances are equal, so read the Pooled row for t, DF and Pr > |t|. If its Pr > F is 0.05 or below the variances are unequal, so read the Satterthwaite row instead.
The DATA step builds and edits a dataset one row at a time, using statements such as INPUT, SET and assignment. The PROC step runs a ready-made procedure, such as PROC TTEST or PROC FREQ, on a dataset that already exists. In short, the DATA step prepares the data and the PROC step analyses it. Both end with a RUN; statement.
Yes. Send your dataset and the assignment and a statistician writes the SAS program, runs the analysis, reads the correct output and interprets it in full, before your deadline, with the .sas program included and free revisions.
Every task gets a custom quote based on the analysis, length and your deadline. Send the details and you see a free, no-obligation price before you pay anything.
A free AI tool cannot open your dataset, choose the right procedure for your design, check the assumptions or interpret the actual SAS output for your study. Our statisticians do all of that, write clean reproducible code, follow your course conventions and back it with free revisions and a money-back guarantee.
Hand it to a statistician and get clean code, accurate output and a clear interpretation before your deadline.
Get my free quote →