Question
Please use SAS and post only the code!!!! use the table below to answer the questions data hw2_jones; input name $ sex $ age height
Please use SAS and post only the code!!!!
use the table below to answer the questions
data hw2_jones;
input name $ sex $ age height weight eye_color;
datalines;
alfred m 14 69 112 blue
alice f 13 56 84 brown
barbara f 14 62 102 brown
henry m 15 67 135 brown
john m 16 70 165 brown
sally f 16 63 120 green
sarah f 17 60 110 green
shawn m 44 72 180 blue
uche f 27 70 170 green
andy m 34 73 185 green
;
run;
proc print data=hw2jones;
title 'Height-Weight Data';
run;
Question 6 (10 points)
Create hw2_3[your last name]; (for example I would create hw2_3jones) based on hw2_2[your last name]
And add binary variables below to it:
Oldandmale = 1 if the person is older than 16 and is male takes the value 1 and otherwise it takes the value 0
Oldandmale2 = male*older
Oldorfemale = 1 if the person is older than 16 or is female takes the value 1 otherwise it takes the value 0
Show the result using proc print
Why variables Oldandmale and Oldandmale2 take exactly same values?
Question 7 (10 points)
Create hw2_4[your last name]; (for example I would create hw2_4jones) based on hw2_1[your last name]
And add variables
Lage = logarithm of age
Expage = exponential of age
Absx = abslute value of diff
Show the result using proc print
Question 8(10 points)
Create hw2_5[your last name]; (for example I would create hw2_5jones) based on hw2[your last name]
Add variable status where:
If the height is less than 60 status is the word short
If the height is between (inclusive) 60 to 75 status is normal
If the height is more than 75 status is tall
Show the result using proc print
Question 9 (10 points)
Create data subsets
hw2_6[your last name]
hw2_7[your last name]
hw2_8[your last name]
from hw2[your last name]
which the first one includes just male, second one includes just females and the third one includes just people older than 22
show your work using proc print
Question 10 (10 points)
Combine three data sets
hw2_6[your last name]
hw2_7[your last name]
hw2_8[your last name]
and call the combination hw2_9[your last name] for example mine would be hw2_9jones
show the result using proc print
Question 11 (10 points)
Sort data set hw2[your last name] at first by sex and then by age
Question 12 (10 points)
Assume people in data set hw2[your last name] and after sorting them with name in alphabetical order, they got these results respectively
85
57
65
98
36
25
68
45
67
91
Create another data set which includes their names and their scores and call it hw2_10[your last name] (for example mine would be hw2_10jones) and merge
hw2_10[your last name]and hw2_[your last name] using name as matching variable. Call the merged data set hw2_11[your last name]
Using proc print Show the result.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started