Please follow all instructions carefully. Please include .txt file with your com
ID: 3370881 • Letter: P
Question
Please follow all instructions carefully. Please include .txt file with your completed solution. SAS is required to solve
Dimensions in millimetres are given for a sample of jellyfish taken from two locations on the Hawkesbu River in New South Wales, Australia. The dimensions measured were breadth and length. Measure- ments are given in the table below - assume a blank measurments are missing ellyfis engt 8.0 9.0 4.0 13.0 cation Dangar Dangar Salamander Dangar Dangar 6.0 0 10.0 15.0 er 18.0 Salamander21.0 19.0 21.0 16 14.0 19.0 Sal 9 10 Salamander Dangar Salamander 11.0 Sal er 18.0 12.0 12 Dangar 13.0 a Enter the data into SAS using a DATALINES statement in the DATA step. Use PROC PRINT to print the resulting data set. Report your output b Create a data frame in R for the jellyfish data. Print the data frame and report the output.Explanation / Answer
(a)
SAS CODE:
DATA MYDATA;
INPUT Jellyfish1-3 Location$5-15 Breadth 17-19 Length;
DATALINES;
1 Danger 6.5 8.0
2 Danger 6.0 9.0
3 Salamander 12.0 14.0
4 Danger 10.0 13.0
5 Danger 15.0 .
6 Salamander 18.0 19.0
7 Salamander 21.0 21.0
8 Salamander . 16.5
9 Danger 11.0 14.0
10 Salamander 16.5 19.0
11 Salamander 18.0 .
12 Danger 12.0 13.0
;
RUN;
PROC PRINT DATA=MYDATA;
RUN;
OUTPUT:
The SAS System
Obs Jellyfish Location Breadth Length
1 1 Danger 6.5 8.0
2 2 Danger 6.0 9.0
3 3 Salamander 12.0 14.0
4 4 Danger 10.0 13.0
5 5 Danger 15.0 .
6 6 Salamander 18.0 19.0
7 7 Salamander 21.0 21.0
8 8 Salamander . 16.5
9 9 Danger 11.0 14.0
10 10 Salamander 16.5 19.0
11 11 Salamander 18.0 .
12 12 Danger 12.0 13.0
(b)
rm(list = ls(all=T))
Jellyfish=c(1:12)
Location=c("Danger","Danger","Salamander","Danger","Danger","Salamander","Salamander","Salamander","Danger","Salamander","Salamander","Danger")
Breadth=c(6.5,6.0,12.0,10.0,15.0,18.0,21.0,NA,11.0,16.5,18.0,12.0)
Length=c(8.0,9.0,14.0,13.0,NA,19.0,21.0,16.5,14.0,19.0,NA,13.0)
data.frame(Jellyfish,Location,Breadth,Length)