In: Statistics and Probability
In this week’s discussion we will continue to explore SAS. This week we will ask you to calculate confidence intervals for the mean using SAS. To obtain confidence intervals for the mean you can once again use proc means. I have posted instructions on using SAS for confidence intervals to Moodle.
Background:
A professor at Southland State University was interested in the amount his students pay for rent in off campus apartments. Using a current list of all students at the university as a sampling frame, he selected a simple random sample of 130 students who live off campus. Each student completed a survey regarding their housing. The resulting data is given in the file “housing.txt.” This file contains the following variables:
Gender: the gender of the student as “Female” or “Male”
Rent: The amount, in dollars, that the student spends on their apartment each month.
Utilities: On average, how much the subjects spend on utilities each month.
Roommates: The number of roommates the subject has.
The post:
For this post you are to:
Locate the text file from the course website and save it to your hard drive.
Create a SAS program that opens the data file and reads in the variables.
Calculate a confidence interval for the mean amount students at Southland State University spend on rent for off campus housing.
Post your program to the group for evaluation. Be sure to follow the SAS programming standards. You do not need to post the output only the program.
Female 350 100 3
Female 892 150 1
Female 555 14 2
Female 665 500 3
Female 510 30 0
Male 528.35 0 2
Female 350 70 1
Female 350 50 1
Female 500 45 3
Female 730 200 3
Male 320 150 1
Male 715 0 1
Male 720 0 3
Female 416 100 2
Female 491 0 3
Male 940 0 1
Female 525 0 3
Female 700 0 3
Female 515 0 1
Male 645 0 3
Female 670 0 3
Female 800 100 3
Female 575 30 3
Male 580 30 3
Female 535 0 2
Female 540 0 2
Female 283.33 18.75 1
Male 540 0 2
Female 400 0 2
Male 620 0 3
Male 574 0 1
Female 500 100 1
Female 520 0 2
Male 600 60 1
Female 585 0 3
Female 525 0 3
Female 540 0 2
Male 780 0 1
Female 500 100 1
Female 515 0 1
Female 850 200 0
Female 520 230 3
Female 670 0 3
Female 350 100 1
Female 700 0 3
Female 500 80 0
Female 580 0 1
Female 364 100 3
Female 495 100 3
Female 505 0 2
Female 505 0 3
Female 475 0 3
Male 400 10 3
Female 600 50 1
Female 450 70 1
Male 520 0 3
Male 500 100 1
Female 500 0 3
Female 395 0 3
Female 560 0 2
Male 750 0 3
Male 530 0 3
Female 1000 600 1
Female 370 40 3
Male 510 0 1
Male 685 0 2
Female 560 0 3
Female 720 0 1
Male 280 10 3
Male 450 50 3
Female 540 0 2
Female 375 65 1
Female 515 0 3
Female 513.75 0 3
Male 700 80 0
Female 450 75 3
Male 299 0 1
Female 1000 0 0
Female 500 0 3
Female 530 0 3
Male 595 80 0
Female 660 40 0
Male 400 50 2
Female 700 0 3
Female 506 150 2
Male 250 50 1
Female 434 0 3
Female 350 45 3
Male 490 530 3
Male 650 0 3
Female 629 60 0
Female 700 0 3
Female 560 0 2
Female 650 0 1
Male 670 0 3
Male 500 0 3
Female 375 0 3
Female 550 100 2
Female 635 150 4
Female 510 60 1
Female 600 0 3
Female 380 50 1
Male 550 0 3
Male 700 100 0
Male 550 120 1
Male 555 0 2
Male 312 84 2
Male 550 100 2
Female 570 250 2
Female 450 50 1
Male 525 0 3
Male 450 100 3
Male 700 0 2
Female 700 250 4
Female 600 0 3
Male 702 0 3
Female 550 200 3
Female 800 100 0
Female 600 0 2
Female 325 50 3
Male 420 61 4
Female 400 100 3
Female 610 0 3
Male 670 0 3
Female 702 0 3
Female 500 300 1
Male 695 0 3
Male 600 40 3
Female 700 0 1
Male 625 75 1
Solution:
use datalines to read data
Input statement to input the varaibles.
Character variable here is gender and it placed a dollar symbol.
SAS PROGRAM to create Housing dataset
data housing;
infile datalines;
input Gender $ Rent Utilities Roommates;
datalines;
Female 350 100 3
Female 892 150 1
Female 555 14 2
Female 665 500 3
Female 510 30 0
Male 528.35 0 2
Female 350 70 1
Female 350 50 1
Female 500 45 3
Female 730 200 3
Male 320 150 1
Male 715 0 1
Male 720 0 3
Female 416 100 2
Female 491 0 3
Male 940 0 1
Female 525 0 3
Female 700 0 3
Female 515 0 1
Male 645 0 3
Female 670 0 3
Female 800 100 3
Female 575 30 3
Male 580 30 3
Female 535 0 2
Female 540 0 2
Female 283.33 18.75 1
Male 540 0 2
Female 400 0 2
Male 620 0 3
Male 574 0 1
Female 500 100 1
Female 520 0 2
Male 600 60 1
Female 585 0 3
Female 525 0 3
Female 540 0 2
Male 780 0 1
Female 500 100 1
Female 515 0 1
Female 850 200 0
Female 520 230 3
Female 670 0 3
Female 350 100 1
Female 700 0 3
Female 500 80 0
Female 580 0 1
Female 364 100 3
Female 495 100 3
Female 505 0 2
Female 505 0 3
Female 475 0 3
Male 400 10 3
Female 600 50 1
Female 450 70 1
Male 520 0 3
Male 500 100 1
Female 500 0 3
Female 395 0 3
Female 560 0 2
Male 750 0 3
Male 530 0 3
Female 1000 600 1
Female 370 40 3
Male 510 0 1
Male 685 0 2
Female 560 0 3
Female 720 0 1
Male 280 10 3
Male 450 50 3
Female 540 0 2
Female 375 65 1
Female 515 0 3
Female 513.75 0 3
Male 700 80 0
Female 450 75 3
Male 299 0 1
Female 1000 0 0
Female 500 0 3
Female 530 0 3
Male 595 80 0
Female 660 40 0
Male 400 50 2
Female 700 0 3
Female 506 150 2
Male 250 50 1
Female 434 0 3
Female 350 45 3
Male 490 530 3
Male 650 0 3
Female 629 60 0
Female 700 0 3
Female 560 0 2
Female 650 0 1
Male 670 0 3
Male 500 0 3
Female 375 0 3
Female 550 100 2
Female 635 150 4
Female 510 60 1
Female 600 0 3
Female 380 50 1
Male 550 0 3
Male 700 100 0
Male 550 120 1
Male 555 0 2
Male 312 84 2
Male 550 100 2
Female 570 250 2
Female 450 50 1
Male 525 0 3
Male 450 100 3
Male 700 0 2
Female 700 250 4
Female 600 0 3
Male 702 0 3
Female 550 200 3
Female 800 100 0
Female 600 0 2
Female 325 50 3
Male 420 61 4
Female 400 100 3
Female 610 0 3
Male 670 0 3
Female 702 0 3
Female 500 300 1
Male 695 0 3
Male 600 40 3
Female 700 0 1
Male 625 75 1
;
run;
#to find confidence interval using procedure univariate for variable Rent
title 'Confidence Intervals for the amount spent on Rent';
ods select BasisIntervals;
Proc univariate data=Housing cibasic;
var Rent;
run;
# we get 95% confidence interval for the mean by above program.if you want 90%
Proc univariate data=Housing cibasic(alpha=0.1);
var Rent;
run;