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

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

.

.

.

.

.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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:

http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_ttest_exampl...

View solution in original post

2 REPLIES 2
ballardw
Super User

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.

Reeza
Super User

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:

http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_ttest_exampl...

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1407 views
  • 2 likes
  • 3 in conversation