BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Meisterbecker
Calcite | Level 5

I need to test that average height in my data between two sexes is equal or not. I want to find the p-value for two sided and one sided t test. How can i do that?

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

One of the SAS supplied data sets will actually allow use of your variables:

proc ttest data=sashelp.class;
  class sex;
  var height;
run;  

The grouping variable goes on a Class statement. Variables to test on the VAR statement. The SIDES= option on the Proc statement is used to control one or two sided and which direction for one sided. Sides=2 is the default, L for one-tailed lower or U for one-tailed upper. Make separate procedure calls with different Sides=. Hint: Use a Title statement with your code so you can tell which option is generating which output.

 

proc ttest data=sashelp.class sides=L;
  class sex;
  var height;
run;  

View solution in original post

2 REPLIES 2
ballardw
Super User

One of the SAS supplied data sets will actually allow use of your variables:

proc ttest data=sashelp.class;
  class sex;
  var height;
run;  

The grouping variable goes on a Class statement. Variables to test on the VAR statement. The SIDES= option on the Proc statement is used to control one or two sided and which direction for one sided. Sides=2 is the default, L for one-tailed lower or U for one-tailed upper. Make separate procedure calls with different Sides=. Hint: Use a Title statement with your code so you can tell which option is generating which output.

 

proc ttest data=sashelp.class sides=L;
  class sex;
  var height;
run;  

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 761 views
  • 1 like
  • 3 in conversation