turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- TTEST and difference of two sample means

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-09-2016 09:57 AM

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

.

.

.

.

.

Accepted Solutions

Solution

06-20-2016
01:40 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to holy9ner

06-09-2016 01:07 PM

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:

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to holy9ner

06-09-2016 10:14 AM

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.

Solution

06-20-2016
01:40 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to holy9ner

06-09-2016 01:07 PM

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: