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

Info icon This 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. De°ne this new variable as follows: 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
Image of page 1

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

View Full Document Right 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 Pet°s are Us . 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. 8. Using the SAS data set HEALTH, compute the body mass index (BMI) de°ned as 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.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern