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?
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;
Use PROC TTEST. See this example: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_ttest_gettingstarted02.htm
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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.