You are on page 1of 2

SAS Homework 1

Due: October 2 Friday

1. Data file scores.txt contains character variable gender: (M or F) and four test scores (English,
History, Math and Science) which are numeric. Read the data in SAS. Calculate average of four
test scores and print first five observations by using PROC PRINT statement.
2. Data file political.csv contains state, political party and age of candidates. Use PROC FREQ to
count frequencies for Party. Test the hypothesis that the mean age of Democrat candidate is
different than mean age of Republican candidates at 10% significance level.
3.

Data file employee.csv contains the following information:


Variable

Description

Informat

ID
NAME
Depart
DateHire
Salary

Employee ID
Employee Name
Department
Hire Date
Yearly Salary

$3.
$20.
$8.
MMDDYY10.
DOLLAR8.

Use the list input to read the data from this file this is comma separated values. Need to use informats.
Compute the frequencies for the department.

4. Read the data file Hospital.dat. Descriptions of the variables are given below:
Variable
Id
Dur_stay

Column
1-2

Label
id no.

4-5

Duration of hospital stay

Age

7-8

Age

Sex

10

Temp

12-15

WBC

17-18

Antibio

20

Bact_cul

22

Sex 1=male/2=female
First temperature following admission
First WBC(x1000) following admission
Received antibiotic 1=yes/2=no
Received bacterial culture 1=yes/2=no

Service

24

Service 1=med/2=surg.

A. Use PROC TTEST to test hypothesis that mean duration of hospital stay is more for male than
female.
B. Create a new categorical variable AgeGr by dividing the age variable in two groups less than or
equal to 35 is young and greater than 35 is old.
Label the variables (Received antibiotic 1=yes/2=no)
(Service 1=medical /2=surgical.)
C. Construct two by two table of AgeGr variable and Antibio (received antibiotic) variable and test
if age and taking antibiotic are related.
D. Test if AgeGr is related to med/surgical service. [In both B and C use Chi-square test with PROC
FREQ] write all four steps of testing hypotheses.

5. Use SAS to verify examples in text book #7.30 and #7.31 (Power calculations.)
6. Use SAS to verify example in text book #7.36 (Sample size determination.)

You might also like