CH5 exercise

CH5 exercise - STAT1303A Data Management 5. Creating New...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
STAT1303A Data Management 5. Creating New Var. and SAS Functions Exercise 5 1. Run the program here to create a temporary SAS data set called SCHOOL: data school; input Age Quiz $1. Midterm Final; /* Add you statements here */ datalines; 12 A 92 95 12 B 88 88 13 C 78 75 13 A 92 93 12 F 55 62 13 B 88 82 ; Using IF and ELSE IF statements, compute two new variables as follows: (a) GRADE (numeric), with a value of 6 if AGE is 12 and a value of 8 if AGE is 13 . (b) The quiz grades have numerical equivalents as follows: A = 95 , B = 85 , C = 75 , D = 70 , and F = 65 . Using this information, compute a course grade (COURSE) as a weighted average of the QUIZ (20%), MIDTERM (30%) and FINAL (50%). 2. Using the SALES data set, create a new, temporary SAS data set containing REGION and TOTALSALES plus a new variable called WEIGHT with values of 1.5 for the North Region, 1.7 for the South Region, and 2.0 for the West and East Regions. 3. Starting with the BLOOD data set, create a new, temporary SAS data set containing all the variables in BLOOD plus a new variable called CHOLGROUP. CHOLGROUP CHOL Low Low 110 Medium 111 140 High 141 High 4. Using the SAS data set HOSP, use PROC PRINT to list observations for SUBJECT values of 5 , 100 , 150 , and 200 . Do this twice, once using OR operators and once using the IN operator. Note: Subject is a numeric variable. HKU STAT1303A (2009-10, Semester 1) 5 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
STAT1303A Data Management 5. Creating New Var. and SAS Functions 5. Using the SALES data set, list the observations for employee numbers (EMPID) 9888 and 0177 . Do this two ways, one using OR operators and the other using the IN operator. Note: EMPID is a character variable. 6. Using the SALES data set, list all the observations where REGION is North and QUANTITY is less than 60 . Include in this list any observations where the customer name (CUSTOMER) is . 7. Using the BICYCLES data set, list all the observations for Road Bikes that cost more than $2,500 or Hybrids that cost more than $660. The variable MODEL contains the type of bike and UNITCOST contains the cost. the weight in kilograms divided by the height (in meters) squared. Create four other variables based on BMI: (1) BMIROUND is the BMI rounded to the nearest integer, (2) BMITENTH is the BMI rounded to the nearest tenth, (3) BMIGROUP is the BMI rounded to the nearest 5, and (4) BMITRUNC is the BMI with a fractional amount truncated. Conversion factors you will need are: 1 Kg equals 2.2 Lbs and 1 inch = .0254 meters. 9. The SAS data set PSYCH contains an ID variable, 10 question responses (QUES1-QUES10), and 5 scores (SCORE1-SCORE5). You want to create a new, temporary SAS data set (EVALUATE) containing the following: (a) A variable called QUESAVE computed as the mean of QUES1-QUES10. Perform this computation only if there are seven or more non-missing question
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 05/04/2011.

Page1 / 7

CH5 exercise - STAT1303A Data Management 5. Creating New...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online