Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ANL351 Examination - July Semester 2015 SAS Programming & Its Application Wednesday, 11 November 2015 10:00 am - 12:00 pm ____________________________________________________________________________________ Time allowed: 2 hours
ANL351 Examination - July Semester 2015 SAS Programming & Its Application Wednesday, 11 November 2015 10:00 am - 12:00 pm ____________________________________________________________________________________ Time allowed: 2 hours ____________________________________________________________________________________ INSTRUCTIONS TO STUDENTS: 1. This examination contains TWENTY (20) Multiple-Choice Questions (MCQ) in Section A and THREE (3) Open-Ended Structured Questions in Section B with ELEVEN (11) printed pages (including cover page). 2. You must answer ALL questions. 3. This is a closed book examination. 4. Please circle your answers to the Multiple-Choice Questions (MCQ) in the answer booklet found in the last page of this Question Paper. You are to detach the answer booklet and attach it to the answer book. 5. All other answers must be written in the answer book. At the end of the examination Please ensure that you have written your examination number on each answer book used. Failure to do so will mean that your work cannot be identified. If you have used more than one answer book, please tie them together with the string provided. THE UNIVERSITY RESERVES THE RIGHT NOT TO MARK YOUR SCRIPT IF YOU FAIL TO FOLLOW THESE INSTRUCTIONS. ANL351 Copyright 2015 SIM University Examination - July Semester 2015 Page 1 of 11 SECTION A (2 marks each. Total 40 marks) 1. Which statement about SAS libraries is true? (a) (b) (c) (d) 2. You refer to a SAS library by a logical name called a libname. A SAS library is a collection of one or more SAS files that are referenced and stored as a unit. A single SAS library can contain files that are stored in different physical locations. At the end of each session, SAS deletes the contents of all SAS libraries. Based on the following SAS program and the observation shown in the PDV, what value will be assigned to \"Amount\"? data payroll; set salaries; if PayClass = 'Monthly' then Amount=Salary; else if PayClass='Hourly' then do; Amount=HrlyWage*Hrs; If Hrs>40 then Msg='CHECK TIMECARD'; end; else Amount=JobRate; run; PDV PayClass Weekly (a) (b) (c) (d) 3. Hrs 44 HrlyWage $20 Amount ? Not specified Hrlywage*Hrs JobRate Salary What does the FIND function do? (a) (b) (c) (d) The FIND function searches a target string for a specified substring. The FIND function removes the characters listed in the charlist from the source. The FIND function removes trailing spaces from the character value. The FIND function removes both leading and trailing spaces. ANL351 Copyright 2015 SIM University Examination - July Semester 2015 Page 2 of 11 4. If var1 is missing and var 2 = 10, what is the result of the assignment statement: num = var1 + var2 / 2? (a) (b) (c) (d) 5. Which of the following determines the length of a new variable at compile time? (a) (b) (c) (d) 6. True False Rewrite sum(Qtr1,Qtr2,Qtr3,Qtr4) to use a numbered range list in place of writing each variable's name. (a) (b) (c) (d) 8. INPUT statement Assignment statement LENGTH statement All of the above Use a DO group in a DATA step when you want to perform multiple statements for a true IF-THEN expression. (a) (b) 7. . (missing) 0 5 10 FRM QTR1 to QTR4 SUM OF QTR1,2,3,4 TOTAL(of QTR1 TO QTR4) sum(of Qtr1-Qtr4) The data set orion.employee_addresses (as shown below) contains nine variables. How many variables will be in the usa, australia, and other data sets respectively? data usa(keep=Employee_Name City State Country) australia(drop=Street_ID State Country) other; set orion.employee_addresses; if Country='US' then output usa; else if Country='AU' then output australia; else output other; run; (a) (b) (c) (d) 1, 2, 4 4, 6, 4 4, 9, 7 4, 6, 9 ANL351 Copyright 2015 SIM University Examination - July Semester 2015 Page 3 of 11 9. What of the following about SAS Array is incorrect? (a) (b) (c) (d) 10. A SAS array is a temporary grouping of SAS variables that are arranged in a particular order. A SAS array is identified by an array name. A SAS array must contain all numeric or all character variables A SAS array is a variable. Emps will be created using PROC Append with the 3 data sets shown below and base = Emps2008. How many variables will be in Emps? Emps2008 First Brett Gender M HireYear 2008 Renee F 2008 Emps2009 First HireYear Sara 2009 Dennis 2009 First Rose Eric (a) (b) (c) (d) Emps2010 HireYear 2010 2010 Country Spain Spain 1 variable 2 variables 3 variables 4 variables ANL351 Copyright 2015 SIM University Examination - July Semester 2015 Page 4 of 11 11. How many variables will be in EmpsAll2 after concatenating EmpsCN and EmpsJP? data EmpsAll2; set EmpsCN EmpsJP; run; EmpsCN First Chang Li Ming Gender M M F EmpsJP First Gender Cho F Tomi M (a) (b) (c) (d) 12. Country China China China Region Japan Japan 1 2 3 4 Given what you know about how SAS processes the DROP and KEEP statements, would these two DATA steps create the same data set? data work.subset1; set orion.sales; drop Salary; Bonus=500; Compensation=sum(Salary,Bonus); BonusMonth=month(Hire_Date); run; data work.subset1; set orion.sales; Bonus=500; Compensation=sum(Salary,Bonus); BonusMonth=month(Hire_Date); drop Salary; run; (a) (b) True False ANL351 Copyright 2015 SIM University Examination - July Semester 2015 Page 5 of 11 13. How many characters can be used in a SAS label? (a) (b) (c) (d) 14. 40 96 200 256 The following SAS code can be used to create a valid user-defined format. PROC FORMAT; VALUE $tates TX='Texas' CA='California' NY='New York' Run; (a) (b) 15. Which of the following steps is typically used to generate reports and graphs? (a) (b) (c) (d) 16. True False DATA PROC REPORT RUN Which of the following is false about the FORMAT statement? (a) (b) (c) (d) It is an instruction to write data values Values stored in the data set are not changed It changes the appearance of a variable's value in a report Values stored in the data set are changed ANL351 Copyright 2015 SIM University Examination - July Semester 2015 Page 6 of 11 17. Suppose you already ran the first SAS program, which created a one-page report. Next, you want to run the second SAS program. What will appear at the top of the second report? title1 'RADIX Company'; title3 'DVD Sales'; proc print data=radix.sales; where UnitSold>=30; run; title2 'Best Sales'; title; proc print data=radix.staff; where Sales>25000; run; (a) (b) (c) (d) 18. 2nd SAS program No titles RADIX Company Best Sales DVD Sales RADIX Company Best Sales RADIX Company Which of the following is not displayed as a result of SAS Date Format? (a) (b) (c) (d) 19. 1st SAS program 11/03/1990 31/11/1989 1989/08/21 31JAN2001 What are accumulating variables in SAS? (a) (b) (c) (d) Accumulating variables allow users to summarise key information about their data sets within the SAS environment Accumulating variables are variables which stores historical processing information about the SAS dataset Accumulating variables allow users to access aggregations of dataset across multiple tables None of the above ANL351 Copyright 2015 SIM University Examination - July Semester 2015 Page 7 of 11 20. Which of the following SAS functions returns the capitalized first letter of each word string? (a) (b) (c) (d) Propcase Upcase Lowcase CapCase SECTION B (Total 60 marks) Question 1 (Total 25 marks) Using SAS Programming, write SAS codes to do the following: (a) Read the orion.customer data set to create work.birthday data set. (2 marks) (b) In the data step, create three new variables: Bday2009, BdayDOW2009, and Age2009: Bday2009 is the combination of the month of Birth_Date, the day of the Birth_Date, and the constant of 2009 in the MDY function. BdayDOW2009 is the day of the week of Bday2009, and Age2009 is the age of the customer in 2009. Subtract Birth_Date from Bday2009 and divide the result by 365.25. (15 marks) (c) Include the following variables in the new data set: Customer_Name, Birth_Date, Bday2009, BdayDOW2009, and Age2009. (3 marks) (d) Format Bday2009 to display in the form 01Jan2012. Age2009 should be formatted to display with no decimal places. Write a PROC PRINT step to create the report below. The results should contain 77 observations. Part of the output is given below: (5 marks) ANL351 Copyright 2015 SIM University Examination - July Semester 2015 Page 8 of 11 Question 2 (Total 25 marks) Monthly customer order data for the first half of the year is stored in the orion.orders_midyear data set. Management is considering a 10-percent price decrease during the first three months of the upcoming year. Management wants to see how such a discount would affect this year's sales. (a) Using SAS Programming and applying the SAS DATA step, create a dataset named special_offer, include a 10-percent discount in months 1 through 3 and create an array, Mon, to access Month1 through Month3 by using a DO loop to adjust each customer's monthly data to include the 10-percent discounts (Month1 through Month3 only). At the same time, create THREE (3) new variables: Total_Sales: the total of current sales over the 6 months, Projected_sales: the total of the adjusted sales over the 6 months (including the 3 discounted months), Difference: the difference between the Total_Sales and Projected_Sales. (15 marks) (b) Print the resulting data set below satisfying the following: Keep only the THREE(3) newly created variables: Total_Sales, Projected_Sales and Difference Suppress the session start date, page number, and observation column. Add in the title as shown in the output below. Use the sum statement to display a total for the Difference variable. Use the DOLLAR. format for all variables. ANL351 Copyright 2015 SIM University Examination - July Semester 2015 Page 9 of 11 (10 marks) Question 3 (Total 10 marks) (a) Write a PROC SORT step to sort orion.orders by Employee_ID to create a new data set called work.orders. (2 marks) (b) Implement data steps to merge orion.staff and work.orders by Employee_ID and create two new data sets: work.allorders and work.noorders, where: work.allorders should include all observations from work.orders, regardless of matches or non-matches from the orion.staff data set. work.noorders should include only the observations from orion.staff that do not have a match in work.orders. Both new datasets should include only Emplyee_ID, Job_Title, Gender, Order_ID, Order_Type, and Order_Date. (8 marks) ----- END OF PAPER ----- ANL351 Copyright 2015 SIM University Examination - July Semester 2015 Page 10 of 11 ANL351 Examination - July Semester 2015 SAS Programming & Its Application Answer Booklet INDEX NUMBER: ______________ SECTION A (2 marks each. Total 40 marks) Question For Examiner's Use Only MARKS Circle the correct answer 1 (a) (b) (c) (d) 2 (a) (b) (c) (d) 3 (a) (b) (c) (d) 4 (a) (b) (c) (d) 5 (a) (b) (c) (d) 6 True False 7 (a) (b) (c) (d) 8 (a) (b) (c) (d) 9 (a) (b) (c) (d) 10 (a) (b) (c) (d) 11 (a) (b) (c) (d) 12 13 True (a) 14 False (b) (c) True (d) False 15 (a) (b) (c) (d) 16 (a) (b) (c) (d) 17 (a) (b) (c) (d) 18 (a) (b) (c) (d) 19 (a) (b) (c) (d) 20 (a) (b) (c) (d) ANL351 Copyright 2015 SIM University Examination - July Semester 2015 Page 11 of 11
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