
Biostat 510: Statistical Computing Packages
SAS Homework 2
Due Tuesday, January 22, 2004
1. Get the contents of your data set created for homework 1. Use the varnum option
so that the variable list will be in the order the variables appear in the data set.
You will need to submit a libname statement first, so that you can use your data
set from homework 1. How many variables are in your data set? How many are
numeric? How many are character? How many observations are in the data set?
What is the physical file name of your data set? What engine was used to create
this data set?
libname b510 V8 "c:\temp\b510";
proc contents data=b510.hrtrate2 varnum;
run;
2. Heartrate: paired t-test:
a. Using Proc Univariate, get descriptive statistics and the distribution for
PULSE1 and PULSE2. Get a histogram using the Histogram statement in
proc univariate. Save your histograms as files, (use type=emf). Include the
histograms in your homework document (you can resize them so that they
will both fit on one page). How would you describe the distribution of
these two variables. What is are there mean, sample size and standard
deviation?
b. Carry out a paired t-test comparing PULSE1 to PULSE2. What are your
null and alternative hypotheses? What is the value of the test statistic? The
degrees of freedom? The p-value? What do you conclude about the means
of these two variables?
3. Hrdiff: one-sample t-test:
a. Calculate a new variable by subtracting Pulse1 from Pulse2. To do this,
you will need to create a new temporary data set.
data hrtrate3;
set b510.hrtrate2;
hrdiff = pulse2-pulse1;
run;
b. Calculate a one-sample t-test to test the null hypothesis that the mean of
hrdiff=0, using any of the methods shown in the handout. Write out your
null and alternative hypotheses. Report the test statistic, the degrees of
freedom and the p-value. What do you conclude about the mean of hrdiff?
4. Heartrate: paired t-test for those who ran and those who did not run:
a. Get descriptive statistics for all variables in your data set separately for
those who ran and those who did not run. You must first sort the data set
by RAN, and then get the descriptive statistics by RAN.
1