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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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