Use looping in SAS and R programming

onohjnn
timer Asked: Oct 10th, 2018

Question Description

Use the given file and attached txt file for the assignment. Looping should be utilized. Code and screenshot of the output should be also attached.

Unformatted Attachment Preview

STAT 362: Homework Assignment #7 Brett D. Hunter Due Saturday, October 13 at 11:59pm You should submit two pdfs when completing this assignment. The first document should include your answers to the questions and any relevant SAS or R Output. The second document should include your SAS program code or R code. Make sure all questions are clearly labeled in each document. 1. Enter the following data set into SAS. Name Tom Harry Jim Bob Andy Cody Ed Greg Dave Steven Smoke Tobacco? yes Yes No Yes No yes Yes no yes Yes Drink Alcohol? no yes no No Yes No no Yes No yes Take Illegal Drugs? no Yes No No No No No no Yes yes Drink Soda? yes No yes Yes Yes no yes no no no Drive to Work? yes Yes Yes yes no yes Yes no Yes Yes Use looping to change all instances of ‘Yes’ to ‘yes’ and all instances of ‘No’ to ‘no’. Print the resulting SAS data set and report your output. 2. Load the Herniorrhaphy.txt data set into R - see the Homework Assignment #6 instructions for information on each variable. Make sure that Birthdate is treated as date data. You only need to print your data set once, in part c. (a) Alter the BUILD variable so that the numbers in the data set are replaced with the builds given in words. That is, all instances of 1 should be changed to ‘emaciated’, all instances of 2 should be changed to ‘thin’, all instances of 3 should be changed to ‘average’, all instances of 4 should be changed to ‘fat’, and all instances of 5 should be changed to ‘obese’. (b) Alter the LEAVE variable so that all instances of 1 are changed to ‘routine’ and all instances of 2, 3, or 4 are changed to ‘intensive care’. (c) Print the data set so that only the Birthdate, Sex, and altered BUILD and LEAVE variables are displayed. Report your output. 3. Suppose the following code is run in R, where runif(1) generates a random number between 0 and 1: count
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

This question has not been answered.

Create a free account to get help with this and any other question!

Related Tags

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors