Install SAS for Windows, if not already installed.
Become familiar with the SAS for Windows Program Manager interface, if not already.
Browse the SAS Help System.
Find the following topic: Starting with Raw Data: The Basics
Send me an e-mail (abh@uvm.edu) from your preferred e-mail address and
tell me what the topic just above and just below this one is.
Copy the file assignment2.sas from the datasets directory
to your computer. Add the necessary SAS statements to do the following:
Set the SAS options to left-justify the output and remove the date.
Create a permanent SAS data set (use a LIBNAME statement).
Read in the variables id, age, height, and weight.
Print out the data after creating the permanent SAS data set.
Send your program, log file, and output file (zipped into a zip file,
if possible) to me via e-mail (abh@uvm.edu).
Write one SAS program to read in each of the 5 "losers" datasets found at
http://www.uvm.edu/~abh/stat295/datasets.
Download these datasets (losers1.dat, losers2.dat, ..., losers5.dat)
to your own computer.
Define a permanent SAS data library in which to store the SAS datasets.
Use INFILE and INPUT statements in the program and use PROC PRINT
after each DATA step to verify that the data has been read correctly.
The main point of this assignment is to decide which type of INPUT
to use (list, column, formatted, or combination) in order to correctly
input the data.
Please use the following variable names: id, name,
group, startweight, endweight. Send your program, log file, and output file
(zipped into a zip file, if possible) to me via e-mail
(abh@uvm.edu).
Write a SAS program to read in "bmi.dat" found at
http://www.uvm.edu/~abh/stat295/datasets.
This file contains two variables, sex and body mass index (BMI).
Create a new grouping
variable that indicates whether or not a person is overweight.
Output males and females into separate SAS data sets.
Although it's no longer true, assume that males are considered
overweight if their BMI
is greater than 27, while females are considered overweight if
their BMI is greater than 25.
Hint: this may involve the use of
IF or DO statements or both. You may create either a character
or a numeric variable.
Send your program, log file, and output file (zipped into a zip file,
if possible) to me via e-mail (abh@uvm.edu).
None.
Write a SAS program to read in "travel_expenses_2006.dat" found at
http://www.uvm.edu/~abh/stat295/datasets.
This file has two types of records, a person record and an expense record.
The person record consists of two variables, name and department, both
character variables with embedded blanks. The expense
record consists of 5 kinds of expenses, airfare, ground transportation, lodging,
meals, and entertainment. All five variables have dollar signs in them
(hint, hint).
Using the code in "SAS_more_input.sas" as a model, write a SAS program to read
in the data from this file.
Using one of the methods for grouping variables demonstrated in
"SAS_create_recode_vars.sas", create a grouping variable for the airfare
expense, with categories "$500 or less" and "Over $500". Use a PROC PRINT
to print it back out, using an appropriate monetary format for the
expense variables.
Send your program, log file, and output file (zipped into a zip file,
if possible) to me via e-mail (abh@uvm.edu).
Write a SAS program to read in "trees2002.dat" and "trees2004.dat"
found at
http://www.uvm.edu/~abh/stat295/datasets.
Each file contains
four variables; plot number, tree number, treatment (c or t), and
dbh (tree diameter in cm at breast height). After reading in each file
and creating a SAS data set for each, combine the two data sets into one
set that has five variables; plot, tree, treatment, dbh in 2002, and
dbh in 2004. Use PROC PRINT after combining to ensure that your single
data set appears correct.
Send your program, log file, and output file (zipped into a zip file,
if possible) to me via e-mail (abh@uvm.edu).
None.
Add to the SAS program you wrote a couple of weeks ago to read in and merge "trees2002.dat" and "trees2004.dat" found at http://www.uvm.edu/~abh/stat295/datasets. Read in a third data file "trees2006.dat" found there and merge it along with the other two. If you need some assistance, see "trees0206.sas" in that same directory.
Reorganize the data from the merged "multivariate" form having three DBH variables into the "univariate" form having a single DBH variable. Use any three of the four methods demonstrated in class today to achieve this result. Don't forget to include a YEAR variable. Use PROC PRINT after each DATA step that performs the reorganizing to see whether your new data set appears correct. Use PROC COMPARE to ensure that your three methods produced the same result.
Send your program, log file, and output file (zipped into a zip file, if possible) to me via e-mail (abh@uvm.edu).
Write a SAS program to read in the data file "beetles.dat" found at http://www.uvm.edu/~abh/stat295/datasets. Variables are DATE (in mm/dd/yyyy format), SITE, TRAP, and BEETLES. The data represent the number of a particular species of beetle found in each trap at 10 different sites collected over a two year period. Create a YEAR variable from the DATE variable (hint: use a function that extracts the year portion from a date value). In a DATA step, calculate the sum of all beetles found at each site in each year and output these sums to a new data set. Since there are 10 sites over 2 years, this new data set should have 20 observations. You will need to use both the FIRST. and LAST. automatic variables as well as a SUM statement to accomplish this task.
Send your program, log file, and output file (zipped into a zip file,
if possible) to me via e-mail (abh@uvm.edu).
None. Happy Thanksgiving!!
Modify the SAS program you wrote for Week 10. Use the Output Delivery System to turn off output to the output window and create a PDF file containing the output instead.
Send your program, log file, and PDF file (zipped into a zip file, if possible)
to me via e-mail (abh@uvm.edu).