Вы находитесь на странице: 1из 2

ST 307 Activity 2

Due: Sunday 26 January 2020 at 11:55pm

For this activity you will create a SAS program and upload that program to Moodle.
● Everyone must submit their own code (any cheating will be reported to student
conduct)
● Be sure that your SAS file adheres to the SAS file submission guidelines
(available on Moodle).
● You MUST Submit a .SAS file or you will receive a ZERO (no exceptions)!

You can save the program at any time. If you’d like to work on it more before submitting,
you’ll probably want to save it and email it to yourself (or use google drive, dropbox, etc.)
or upload it to moodle and then redownload it and replace it before the deadline with a
finished copy.

Dataset
For this activity, we will be using the built in SAS help data set called Cars. More
information on this data set can be found at this website (pg.24):
https://support.sas.com/documentation/tools/sashelpug.pdf

Task 1: Conceptual questions (6 points)


After the header in your program, answer the following questions in comments. Answers
should be no more than 2 words!

1. Fill in the blank: In SAS quantitative data is called ________ data. (1pt)
2. Which PROC allows one to find measures of center and spread (ex. mean, median,
standard deviation). (1pt)
3. What is the PROC that lets you make graphs like bar charts, histograms, and scatter
plots? (1pt)
4. Please respond true or false to the following questions:
a) A histogram is for graphing a categorical variable. (1pt)
b) A scatter plot can be used with one categorical variable and one numeric
variable. (1pt)
c) I can use PROC CORR to find the correlation of two categorical variables. (1pt)

Task 2: Analyze the Cars dataset (20 points)

Write code corresponding to each step below, that is, do not change the code for step 1
to step 2 (you can copy and paste it so you don’t have to retype it, but leave the answer
to each step in your program). If you do not have code for every question (clearly labeled
with the question number above it) you will not receive points for that question:

1. To find out more about this data set we will use PROC CONTENTS to look at the
different variables in the data set. Run PROC CONTENTS on the SASHELP dataset
called cars (SASHELP.CARS). (2pt)
a) Answer in a comment: how many numeric variables are there? (1pt)

1
2. Use an appropriate PROC Procedure to print out the cars dataset. (2pt)
a) In a comment below your code: How many observations are there in the data
set? (1pt)

3. Now we are interested in looking at the correlation between two variables in our data
set. Use PROC CORR to create a correlation matrix of the following variables:
MPG_CITY, MPG_HIGHWAY, HORSEPOWER, and MSRP. (2pt)
a) In a comment below your code answer: What is the correlation between
MPG_CITY and MPG_HIGHWAY?. (1pt) Does this make sense with your
intuition about these variables? Why or why not? (1pt)

4. Now we want to see which region of the world produced the most cars in our
dataset. The variable in the data set is called ORIGIN. Using PROC FREQ make a
contingency table of the ORIGIN variable (2pt)
a) In a comment below your code answer: Which of the three regions produced
the most cars? (1pt)

5. Looking at tables can be informative but often graphs are easier to read. Use PROC
SGPLOT and the VBAR statement to make a vertical bar graph of the ORIGIN
variable. (3pt) (Here are some examples of some PROC SGPLOTS:
https://documentation.sas.com/?docsetId=grstatproc&docsetVersion=9.4&docsetTar
get=p1t32i8511t1gfn17sw07yxtazad.htm&locale=en)

6. Use PROC UNIVARIATE and a VAR statement (2pt) to find the following (report the
two numbers in comments below your code):
a) The mean of the MPG_CITY (1pt)
b) The median of the MPG_HIGHWAY (1pt)

Make sure you have a comment prior to each step above that explains what the step
does and has the question number at the beginning! Don’t forget to change the header
as well and use proper spacing (see the SAS file submission guidelines on Moodle for all
requirements) Up to 10 points can be deducted for improper comments or spacing.
Save this program, ensure that it is a SAS file (*.SAS), and submit it to Moodle! If it is
NOT a .SAS file it will NOT be graded!

Вам также может понравиться