BookmarkSubscribeRSS Feed
Calcite | Level 5

Hello, I am trying to do some two sample t tests with proc tabulate.


Is it even possible to do a two sample T-test with proc tabulate.


I have ran the ttest with proc ttest, and gotten the results I want. My issue is the output is difficult for  my teammate to understand. I was trying to simplify it with proc tabulate. 


proc ttest data = work.t_test alpha=.05;
class ax_mcell_email_ibs_pm933;
var ct_bert1_score ;

This is my ttest sas code. This is working and give this output:Proc Ttest outputProc Ttest output


This is the code I have for proc tabulate. It is very close to what I want but appears to complete a 1 sample t test instead of a two sample ttest.

proc tabulate data = work.t_test;
class ax_mcell_email_ibs_pm745; /*Update current Program*/
var ct_bert1_score; 
table (ax_mcell_email_ibs_pm745='M_CELL'), ct_bert1_score * (n mean stddev t prt);

Proc Tabulate OutputProc Tabulate Output


The following is what I want the output to look like, I took the output from proc tabulate and edited it with a text editor. 

Wanted OutputWanted Output

Diamond | Level 26

In PROC TABULATE, the T and PRT are for the hypothesis that the mean is zero. They do not give you the ability to test the hypothesis that the two means are equal to each other (you may be able to program this yourself in TABULATE, but why bother when PROC TTEST does it for you?)

Paige Miller
Calcite | Level 5

Personally, I have no issue with Proc ttest. My team is trying to automate some processes/ reports. The ttest procedure is apparently difficult for those with no statistics background to understand. Is there a way to get something similar to the output I want? I have tried ods output, proc format and just can't seem to get it. In words, I just want the output to have the N, mean, std. dev. t statistic, p-value, and a pass/fail indicator.

Diamond | Level 26

If you store the output from PROC TTEST in a SAS data set, you should be able to get PROC TABULATE or PROC REPORT or even a DATA step to produce the desired table.

Paige Miller



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2 in conversation