Assignment 2 instructions

pdf

School

Florida State University *

*We aren’t endorsed by this school

Course

STA 3024

Subject

Statistics

Date

Feb 20, 2024

Type

pdf

Pages

2

Uploaded by jasenrinehart

Report
STA 3024 Assignment 2 Produce appropriate SAS code to complete the following tasks. 1. (34 points total) The file BatFail.txt contains information on an experiment involving the life of cell phone batteries under varying conditions and characteristics. The variables included, in order, are Condition (temperature level), Brand (battery manufacturer), Age (battery age), Wifi (Wifi on or off), and TimetoFail (battery life). a. (10 points) Read the entire data using the list style of input. Make sure to the read the full-length and complete data values including cases where there are multiple words for a variable value. Print the entire data set. b. (8 points) Create a user-defined format (using Proc Format) such that the brand letter is associated with the manufacturer. Here are the manufacturers of the brands: A = Positive Battery, B = Panasonic, C = F.W. Webb, and D = Samsung. Apply your created formatting when printing the entire data set such that the manufacture name is displayed. c. (8 points) Create a new data set with a second data step that modifies the original data set such that the new data set has only “Cold” conditions and time-to-fail less than 90. Print the resulting data set using the formatting applied in (b). d. (8 points) Print the original data set in (a) but for only the observations that have “Cold” conditions and time-to-fail less than 90. Your print procedure should utilize a WHERE statement. 2. (32 points total) The text file Schools1.txt has five variables (listed in the order given): School_ID, Magnet, Grade, Students, and Score. Read the data into a SAS data set in whichever style is most convenient. a. (8 points) In the same data step used to read the data create a new variable called Enrollment which is a character-based variable that takes on a value “Small” if the number of students is less than 60; “Medium” if the number of students is between 60 and 99, inclusive; and “Large” if 100 or more. Make sure you use efficient code. Print the entire data set which includes your new variable. b. (8 points) Sort your data by the variable Grade such that the original order is retained in the original data set and the sorted data is output to a different, new data set. Print the first 8 observations for all variables of the sorted data set. c. (8 points) Another text file Schools2.txt has three variables. The first variable is the identical to the School_ID variable from the Schools1 data set. The second variable, spending per student (Expenditures), and the third variable, percent gifted students (Gifted), have non-standard numeric data values. Use the list style of input to read all variables such that they are stored as standard numeric values. Print the entire data set to confirm all variables are numeric. d. (8 points) Print the entire data set from (c) again but re-format the values of the variables Expenditures and Gifted as they were originally formatted.
3. (34 points total) Refer to the file called diamond.csv and complete the following tasks: a. (8 points) Use PROC IMPORT to import the file into SAS so that it can be used as a SAS data set. b. (8 points) Using the data set produced in (a), print just the carat, color, and price values for only diamonds considered to be one-half carat (actual carat weight between 0.48 and 0.52 carat inclusive) and having a color rating of “D”. c. (10 points) Using a new data step, create a new data set that (1) consists of diamonds that only have the “I” color and (2) creates a new variable Size that classifies diamonds less than 0.55 carats as “Little” and diamonds 0.55 carats and larger as “Big”. Print the first 25 observations from the resulting data set. d. (8 points) Sort the data set in (c) by Size and Clarity (listed in that order) and print the data set for only the variables Clarity and Price using a BY statement applied to Size.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help