0% found this document useful (0 votes)
38 views1 page

SAS Practice Exercise: Average Score For Each Exam?

This document provides instructions for a SAS practice exercise involving a dataset on 6 students. The exercise involves: 1) reading in the student data and naming variables, 2) using PROC PRINT to display the data, PROC CONTENTS to view dataset information, and PROC FREQ to tabulate gender and major counts, 3) using PROC MEANS to compute exam score averages, 4) adding a final grade variable as the average of exams 1 and 2, 5) verifying the new variable and computing its summary statistics, and 6) creating an exam 1 vs exam 2 scatter plot using PROC SGPLOT and saving the program.

Uploaded by

Sritej Gunta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views1 page

SAS Practice Exercise: Average Score For Each Exam?

This document provides instructions for a SAS practice exercise involving a dataset on 6 students. The exercise involves: 1) reading in the student data and naming variables, 2) using PROC PRINT to display the data, PROC CONTENTS to view dataset information, and PROC FREQ to tabulate gender and major counts, 3) using PROC MEANS to compute exam score averages, 4) adding a final grade variable as the average of exams 1 and 2, 5) verifying the new variable and computing its summary statistics, and 6) creating an exam 1 vs exam 2 scatter plot using PROC SGPLOT and saving the program.

Uploaded by

Sritej Gunta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

SAS Practice Exercise

This exercise will get you started in SAS by writing a simple program. Open SAS with a blank (new)
editor window. Follow the example in lesson 1 for the programming statements required. This example is
similar.
1.

Consider the following dataset on 6 students.


Student
ID

Gender

Major

Exam 1

Exam 2

001
002
003
004
005
006

M
M
F
M
F
F

BIO
EPI
EPI
BIO
EPI
EPI

80
75
90
83
94
88

84
73
86
85
94
84

a. Write a SAS program that reads in the data within the program. Name the variables
StudentID, Gender, Major, Exam1, and Exam2. StudentID, Gender, and Major are character
variables; Exam1 and Exam2 are numeric variables. Name the SAS dataset class.
b. Display the values of the variables using PROC PRINT. Make sure the variables have been
read in correctly. Also, run PROC CONTENTS to display information about the dataset
created.
c. Use PROC FREQ to tabulate the number of men and women, and the number in each major.
d. Use PROC MEANS to compute summary statistics for exam 1 and exam 2. What is the
average score for each exam?
e. Go back into the DATA step and add one variable named final which is the average of exam1
and exam2. The line of code for this is:
final = (exam1 + exam2)/2;
f. Use PROC PRINT to verify the new variable was computed correctly.
g. Use PROC MEANS to compute summary statistics for the final grade.
h. Use PROC SGPLOT to plot exam2 versus exam1 on an x-y plot. Use the following code:
PROC SGPLOT DATA=class;
SCATTER X=exam1 Y=exam2;
RUN;
i.

Save your program to your computer. Give it the name exercise1. It will automatically have a
.sas extension. Exit SAS after your have saved your program. Then enter SAS again and
bring in the program that you saved.

You might also like