I have attached a data set that I am working on. Basically, i ned to run a 95% confidence interval for the difference in population mean hours of sleep for students who are sleep deprived and who are not. My issue is, I have no idea how to do this, and every example i see for TTEST and confidence interval involves data that people are entering themselves and each variable only has one item.
Here is my issue, the below is exactly what is the format of the excell sheet. I need to do the individual means of the yes and no seperately, and then find the difference between the two sample means. after that, i need to construct a 95% confidence interval for the difference in population mean hours of sleep for studetns who would say they are (yes), and the studetns who said they were not (no). Every example i see only has numbers for var1, but i need to actually do it for subgroups within the var 1. I do not know how to do this.
Var1 var 2
yes 2
no 3
yes 6
no 7
yes 9
no 10
yes .
no .
yes
no
yes
no
.
.
.
.
.
Two sample T-Tests - You would have to download the sample dataset to see the data structure but it matches your data.
http://www.ats.ucla.edu/stat/sas/whatstat/whatstat.htm
http://www.ats.ucla.edu/stat/sas/output/ttest.htm
And another way, if you precalculate statistics:
For a ttest on your data you would use:
proc ttest data=have;
class var1;
var var2;
run;
The CLASS variable is one that designates membership in a group, sleep deprived in your case. The VAR variable(s) are ones you want to conduct the test for similar means.
Two sample T-Tests - You would have to download the sample dataset to see the data structure but it matches your data.
http://www.ats.ucla.edu/stat/sas/whatstat/whatstat.htm
http://www.ats.ucla.edu/stat/sas/output/ttest.htm
And another way, if you precalculate statistics:
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.