STATION

Similar documents
work.test temp.test sasuser.test test

SAS Institue EXAM A SAS Base Programming for SAS 9

PASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year

Name: Batch timing: Date: The SAS data set named WORK.SALARY contains 10 observations for each department, currently ordered by DEPARTMENT.

Base and Advance SAS

MATH 707-ST: Introduction to Statistical Computing with SAS and R. MID-TERM EXAM (Writing part) Fall, (Time allowed: TWO Hours)

Objectives Reading SAS Data Sets and Creating Variables Reading a SAS Data Set Reading a SAS Data Set onboard ia.dfwlax FirstClass Economy

BASICS BEFORE STARTING SAS DATAWAREHOSING Concepts What is ETL ETL Concepts What is OLAP SAS. What is SAS History of SAS Modules available SAS

Exam Name: SAS Base Programming for SAS (r) 9 Exam Type: SAS Exam Code: A Total Questions: 127

INTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS

Introduction to the SAS Macro Facility

SAS coding for those who like to be control

SAS Macro Language: Reference

SAS Institute Exam A SAS Advanced Programming Version: 6.0 [ Total Questions: 184 ]

Introduction. Getting Started with the Macro Facility CHAPTER 1

chapter 2 G ETTING I NFORMATION FROM A TABLE

SASInstitute A SAS Base Programming. Download Full Version :

Exam Name: SAS Base Programming for SAS 9

SAS Macro. SAS Training Courses. Amadeus Software Ltd

SAS CURRICULUM. BASE SAS Introduction

TOP 10 (OR MORE) WAYS TO OPTIMIZE YOUR SAS CODE

RESTRICTING AND SORTING DATA

DATA Step Debugger APPENDIX 3

Tales from the Help Desk 5: Yet More Solutions for Common SAS Mistakes Bruce Gilsen, Federal Reserve Board

Lecture-14 Lookup Functions

Retrieving Data Using the SQL SELECT Statement. Copyright 2004, Oracle. All rights reserved.

Chapter 1 The DATA Step

SAS PROGRAM EFFICIENCY FOR BEGINNERS. Bruce Gilsen, Federal Reserve Board

SAS PROGRAM EFFICIENCY FOR BEGINNERS. Bruce Gilsen, Federal Reserve Board

Bruce Gilsen, Federal Reserve Board

SAS 101. Based on Learning SAS by Example: A Programmer s Guide Chapter 21, 22, & 23. By Tasha Chapman, Oregon Health Authority

Introduction to SAS Statistical Package

Hidden in plain sight: my top ten underpublicized enhancements in SAS Versions 9.2 and 9.3

Retrieving Data Using the SQL SELECT Statement. Copyright 2004, Oracle. All rights reserved.

SAS Macro Dynamics - From Simple Basics to Powerful Invocations Rick Andrews, Office of the Actuary, CMS, Baltimore, MD

Taming a Spreadsheet Importation Monster

Database Programming with SQL

SAS Online Training: Course contents: Agenda:

Getting Information from a Table

Retrieving Data Using the SQL SELECT Statement. Copyright 2009, Oracle. All rights reserved.

Overview of Data Management Tasks (command file=datamgt.sas)

SAS Scalable Performance Data Server 4.3

SAS 9 Programming Enhancements Marje Fecht, Prowerk Consulting Ltd Mississauga, Ontario, Canada

DSCI 325: Handout 15 Introduction to SAS Macro Programming Spring 2017

1 Files to download. 3 Macro to list the highest and lowest N data values. 2 Reading in the example data file

Using the SQL Editor. Overview CHAPTER 11

MS EXCEL: TABLES, FORMATS, FUNCTIONS AND MACROS

Advanced SQL Processing Prepared by Destiny Corporation

Different Methods for Accessing Non-SAS Data to Build and Incrementally Update That Data Warehouse

informats in Reading Date and Time Values the colon-format modifier in Reading Free-Format Data.

DSCI 325: Handout 9 Sorting and Options for Printing Data in SAS Spring 2017

GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement

What Is SAS? CHAPTER 1 Essential Concepts of Base SAS Software

SAS Macro Programming for Beginners

A SAS Macro for Producing Benchmarks for Interpreting School Effect Sizes

GIFT Department of Computing Science. CS-217/224: Database Systems. Lab-5 Manual. Displaying Data from Multiple Tables - SQL Joins

Merge Processing and Alternate Table Lookup Techniques Prepared by

Bsc (Hons) Software Engineering. Examinations for / Semester 1. Resit Examinations for BSE/15A/FT & BSE/16A/FT

Program Validation: Logging the Log

Foundations and Fundamentals. SAS System Options: The True Heroes of Macro Debugging Kevin Russell and Russ Tyndall, SAS Institute Inc.

INTRODUCTION TO PROC SQL JEFF SIMPSON SYSTEMS ENGINEER

Get Going with PROC SQL Richard Severino, Convergence CT, Honolulu, HI

Using Dynamic Data Exchange

MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9)

Journey to the center of the earth Deep understanding of SAS language processing mechanism Di Chen, SAS Beijing R&D, Beijing, China

INDEX. 1 Basic SQL Statements. 2 Restricting and Sorting Data. 3 Single Row Functions. 4 Displaying data from multiple tables

DBLOAD Procedure Reference

Using Different Methods for Accessing Non-SAS Data to Build and Incrementally Update That Data Warehouse

Beginning Tutorials. PROC FSEDIT NEW=newfilename LIKE=oldfilename; Fig. 4 - Specifying a WHERE Clause in FSEDIT. Data Editing

Get Started Writing SAS Macros Luisa Hartman, Jane Liao, Merck Sharp & Dohme Corp.

SAS Macro Dynamics: from Simple Basics to Powerful Invocations Rick Andrews, Office of Research, Development, and Information, Baltimore, MD

Acknowledgments xi Preface xiii About the Author xv About This Book xvii New in the Macro Language xxi

Microsoft Access XP (2002) - Advanced Queries

Lab # 6. Using Subqueries and Set Operators. Eng. Alaa O Shama

Using SAS Files CHAPTER 3

Stat Wk 3. Stat 342 Notes. Week 3, Page 1 / 71

Restricting and Sorting Data. Copyright 2004, Oracle. All rights reserved.

Intellicus Enterprise Reporting and BI Platform

SECTION 1 DBMS LAB 1.0 INTRODUCTION 1.1 OBJECTIVES 1.2 INTRODUCTION TO MS-ACCESS. Structure Page No.

Going Under the Hood: How Does the Macro Processor Really Work?

David Ghan SAS Education

Basic SQL Processing Prepared by Destiny Corporation

GET A GRIP ON MACROS IN JUST 50 MINUTES! Arthur Li, City of Hope Comprehensive Cancer Center, Duarte, CA

Are Your SAS Programs Running You? Marje Fecht, Prowerk Consulting, Cape Coral, FL Larry Stewart, SAS Institute Inc., Cary, NC

Join, Sub queries and set operators

EVALUATION ONLY. In this chapter, you will learn new. Text and Analysis EXCEL 2016 CHAPTER TIMING PROJECT: ANALYZING SALES INFORMATION

Techdata Solution. SAS Analytics (Clinical/Finance/Banking)

Purchase this book at

Using Data Set Options in PROC SQL Kenneth W. Borowiak Howard M. Proskin & Associates, Inc., Rochester, NY

SAS Programming Basics

More About SAS Macros

Arthur L. Carpenter California Occidental Consultants, Oceanside, California

Using the Set Operators. Copyright 2006, Oracle. All rights reserved.

Accessing Data and Creating Data Structures. SAS Global Certification Webinar Series

MICROSOFT EXCEL 2000 LEVEL 3

General Tips for Working with Large SAS datasets and Oracle tables

DSCI 325 Practice Midterm Questions Spring In SAS, a statement must end

QUEST Procedure Reference

Cisco IOS Shell. Finding Feature Information. Prerequisites for Cisco IOS.sh. Last Updated: December 14, 2012

Virtual Accessing of a SAS Data Set Using OPEN, FETCH, and CLOSE Functions with %SYSFUNC and %DO Loops

Transcription:

------------------------------STATION 1------------------------------ 1. Which of the following statements displays all user-defined macro variables in the SAS log? a) %put user=; b) %put user; c) %put _user_; d) options mprint Answer: c To display all user-defined macro variables and their values in the SAS log, you use the %PUT statement with the _USER_ argument. The MPRINT option specifies that text that is sent to the compiler as a result of macro execution is printed in the SAS log. 2. The data set Company.Employee has 100 observations and contains the variables Name, Salary and Birthdate. The following SAS program is submitted: proc sql; <insert SQL procedure statement here> select name, salary, birthdate from work.employees; quit; Which of the following statements successfully completes the program to append the data in Work.Newemployees to Company.Employee? a) alter company.employee (name, salary, birthdate) b) update company.employee (name, salsry, birthdate) c) modify company.employee (name, salary, birthdate) d) insert into company.employee (name, salary, birthdate) Answer: d The INSERT INTO statement appends data to the Company.Employee table. The ALTER TABLE statement (rather than the ALTER statement) enables you to add, drop, and modify columns, but you cannot use it to append data sets. The UPDATE statement enables you to modify values in existing rows, but you cannot use it to append data sets. The MODIFY clause works with the ALTER statement to enable you to change column attributes, but you cannot use it to append data sets. 3. The following SAS program is submitted: data two; y= 2 ; %let x= 10; %let var= y; data one; set two (keep= &var); z= &var*&x; Which of the following answers is the value of the variable z when the program finishes executing? a) _ERROR_ b) 20 c) y*20 d). (missing value) Answer: b The macro variable reference &var resolves to Y in the SET statement. Then, the macro variable reference &var resolves to Y in the assignment statement, and Y is a character variable with the value of 2. The macro variable reference &x resolves to a numeric value of 10. SAS performs automatic character-tonumeric conversion on the value of the variable Y. Therefore, the value of the variable Z is 20.

4. After submitting a SAS program, the following is written to the SAS log: 11 %let date= o; 12 proc print data= sashelp.class; ERROR: The PUT function referenced in the %SYSFUNC or %QSYSFUNC macro function is not found. 13 title SAS Base date is %sysfunc(put(&date, date9.)) ; 14 What is the cause of this error message? a) the PUT function does not exist b) the macro variable reference &date needs to have double quotation marks around it c) the PUT function cannot be used in %SYSFUNC d) the %PUT function is missing a percent sign in front of the word put. Answer: c To use the %SYSFUNC function to apply a numeric format (such as DATE9.) to a numeric macro expression(such as 0), you must specify the PUTN function. The PUT function, although available in other contexts, is not supported by %SYSFUNC.

------------------------------STATION 2------------------------------ 1. At the beginning of a new SAS session, the following program is submitted: %macro one; %let proc= means; proc &proc data= sashelp.class; %mend; %one Where is the macro variable proc stored? a) in the local symbol table b) in the global symbol table c) in the SAS data set Work.Sasmacr d) the program fails to execute because PROC is a reserved word Answer: a New macro variables that are created during macro execution are created in the macro's local symbol table. Macro variables that are created with a %LET statement in open code are stored in the global symbol table. PROC is not a reserved word in the SAS macro facility. 2. The table One has five million observations. Table Two has one thousand observations. These tables have identical column attributes. Concatenating tables One and Two should result in 5,001,000 observations. Which of the following SAS techniques uses the least CPU time and fewest I/O operations to process? a) the APPEND procedure b) the SET statement in the DATA step c) the INSERT INTO statement in an SQL procedure d) the OUTER UNION CORR operator in an SQL procedure Answer: a Both the SET statement in the DATA step and the OUTER UNION CORR operator in the SQL procedure read all observations from all input data sets, while the APPEND procedure reads only the observations in the appended data set. Thus, both I/O and CPU usage are greater with either the SET statement or the OUTER UNION CORR statement than with the APPEND procedure. While the INSERT statement reads only the observations in the inserted data set, just as the APPEND procedure does, the SQL procedure in general requires more procedure code and therefore more I/O and CPU usage than the APPEND procedure. 3. Which of the following statements cannot be used in a DATA step that reads a raw data file as input? a) KEEP statement b) IF statement c) FORMAT statement d) WHERE statement Answer: d You cannot use the WHERE statement to subset observations that are read from a raw data file. 4. Which statement about this program is true? proc print data= orion.sales; var employee_id salary; where country= AU ; by gender; label salary= Annual Salary ; a) the program will run correctly only if Orion.Sales is sorted in ascending order by Country b) the PROC PRINT report displays only the observations in which the value of Country is AU

c) the label and format specified in the program are stored in Orion.Sales d) none of the above Answer: b The WHERE statement subsets the data so that the report displays only the observations in which the value of Country is AU. The input data set must be sorted by Gender, the variable specified in the BY statement. The label Annual Salary will not be displayed because the LABEL option is not included in the PROC PRINT statement.

------------------------------STATION 3------------------------------ 1. Which statement about this PROC SORT step is true? proc sort data= orion.staff; out= work.staff; by descending salary; manager_id; a) the sorted data set overwrites the input data set b) the observations are sorted by Salary in descending order, and then by Manager_ID in descending order c) a semicolon should not appear after the input data set name d) the sorted data set contains only the variables specified in the BY statement Answer: c This PROC SORT step has a syntax error: a semicolon in the middle of the PROC SORT statement. If you correct this syntax error, this step sorts orion.staff by Salary in descending order and by Manager_ID in ascending order. The step then creates the temporary data set staff that contains the sorted observations and all variables. 2. Which of the following is not true of SAS date values? a) they are numeric b) they can be positive or negative values c) they represent the number of days between the day being stored and a base date d) the base date is January 1, 1900 Answer: d The base date is January 1, 1960. 3. The following SAS program is submitted at the start of a new SAS session: data sashelp.test: set sashelp.class; if _N_ > 5; proc print data= test noobs; Sashelp.Class contains 5 variables and 19 observations. Which one of the following answers explains what happens when this code is submitted? a) the SAS data set Test does not exist and no report is generated b) the SAS data set Test has no observations c) the PRINT procedure statement syntax is incorrect and no report is generated d) the PRINT procedure statement syntax is correct and a report is generated Answer: a The code that is submitted creates the data set Sashelp.Test. The PRINT procedure is attempting to use Work.Test. Because we are in a new session where this is the only code submitted, Work.Test does not exist. 4. The data portion of the Work.Salaries data set is shown below. Note that Salary is an 8-byte character variable. name status salary Liz S 15,600 Herman S 26,700 Marty S 35,000

The following SAS program is submitted: proc print data= work.salaries; where salary GT 20000; No observations are output. Why? a) WHERE statement will not do any automatic data conversion the step fails b) GT is not a valid operator. The symbol > must be used c) GT is a valid operator, but it does not work with character data d) the WHERE statement must use the value 20,000 Answer: a Using the character variable Salary as a numeric variable in the WHERE statement results in a syntax error that will stop the processing of the step. Unlike many other situations in SAS, in WHERE conditions there is no automatic character to numeric or numeric to character conversion.

------------------------------STATION 4------------------------------ 1. The following SAS program is submitted: libname sasdata SAS-data-library ; data work.boston work.dallas (drop= city equipment); set sasdata.cities (keep= orig price city dest equipment); if dest= BOS then output work.boston; else if dest= DFW then output work.dallas; drop dest; Which variables are output to both data sets? a) City and Equipment b) Price and Orig c) Price, Orig, and Dest d) City, Price, Orig, and Equipment Answer: b The variables Orig, Price, City, Dest, and Equipment are read in. The variable Dest is dropped from both of the new data sets being created and the variables City and Equipment are dropped from Work.Dallas. So, the data set Work.Boston contains Orig, Price, City, and Equipment and the data set Work.Dallas contains Orig and Price. The only 2 variables that end up in both data sets are Price and Orig. 2. The variable Name in the data set Employee has a $CHAR10. format. The variable Name in the data set Sales has a $CHAR15. format. The following SAS program is submitted: data both; length name $ 20; merge sales employee; by id; What is the format of the variable Name in the data set Both? a) $20 b) $CHAR10. c) $CHAR15. d) $CHAR20. Answer: c The first attribute seen for a variable is the one used in the current DATA step. Given that the Work.Sales data set is positioned first on the MERGE statement, the variable Name would have a format of $CHAR15. in the new data set Work.Both. The LENGTH statement only gives the variable Name a predetermined maximum length. 3. The following SAS program is submitted: data work.words; word1= Is ; word2= It ; word3= Blue ; all= catx(word1, word2, word3); The variable All is created with which value? Note that the quotes are shown for readability and are not part of the value. a) It Is Blue b) ItIsBlue c) It Is Blue d) IsItBlue

Answer: b In the CATX function, the first argument is the delimiter that is used when the other arguments are put together. So, we are putting It together with Blue and have Is as the delimiter between them. 4. Assume that Sasuser.One does not exist and that the following SAS program is submitted at the beginning of a new SAS session: data sasuser.one; x= 1; y= 27; output one; What is the result? a) the data set Sasuser.One is created with 2 variables and 3 observations b) the data set Sasuser.One is created with 2 variables and 0 observations c) the DATA step does not execute d) the data set Sasuser.One is created with 2 variables and 1 observations Answer: b The OUTPUT statement is told to use Work.One, but it is not a data set that is specified on the DATA statement. This generates a syntax error and stops the execution of the DATA step. At compile time, a data set Sasuser.One with 2 variables and 0 observations would be created, but only if it did not already exist. A preexisting Sasuser.One would not be affected by this DATA step.

------------------------------STATION 5 - Just for Fun----------------------------- 1. If a doctor gives you 3 pills and tells you to take one pill every half hour, how long would it be before all the pills had been taken? a) 3 hrs b) 1.5 hrs c) 1 hr d) none of the above Answer: c If you take a pill at 1 o clock, then another at 1:30 and the last at 2 clock, they will be taken in 1 hour. 2. Divide 30 by one half and add ten. What do you get? a) 20 b) 25 c) 60 d) 70 Answer: d Dividing by half is the same as multiplying by 2. Therefore (30/0.5)+10=70. 3. At a conference, 12 members shook hands with each other before and after the meeting. How many total number of handshakes occurred? a) 100 b) 132 c) 145 d) 144 Answer: b The first person shook hands with 11 remaining people, the second person also shook hands with 11 people, but we count 10, as the hand shake with the first person has already been counted. Then add 9 for the third person, 8 for the fourth one & proceeding in this fashion we get: 11 + 10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 = 66. Hence 66 hand shakes took place before & 66 after the meeting, for a total of 132. 4. Select the item below which would complete the pattern: a. b. c. d. Answer: d

-------------------STATION 6- What do you know about SAS? ----------------- 1. How many tons of M&M s was it estimated that SAS consumed (as at December 7, 2011)? a. 1 b. 8 c. 11 d. 22 e. 53 Answer d 22 tons 2. Match the date=0 value to the correct software a. Jan 1 1753 2. SQL b. Jan 0 1900 1. Excel c. Jan 1 1960 4. SAS d. Jan 1 1970 3. Javacript e. Jan 1 2000 5. Netezza 3. Which of the following are true or false a. SAS stands for: South African Ship - the South African Navy Ship Prefix True b. SAS stands for: Scandinavian Airlines True c. SAS stands for: Surfers Against Sewage True d. SAS is a village in Iran True e. SAS stands for: Space Activity Suit True f. SAS stands for: San Antonio Spurs True 4. Timeline - match the SAS Canada Events to the dates a. SAS Canada expands to the Quebec market 6. 1991 b. SAS Canada expands into Western 3. 1995 c. SAS Canada opens its Ottawa office. 1. 1993 d. SAS Canada celebrates hiring 150th employee 7. 2000 e. SAS Canada opens the SAS Institute in Toronto, with 2 employees. 2. 1988 f. SAS celebrates 25 years of business in Canada 4. 2013 g. SAS Canada, King Street East is recognized Canada s first LEED 5. 2008 h. SAS Canada s corporate headquarters opens at 280 King Street East. 8. 2005

ANSWERS SHEET Station 1 Station 2 Station 3 Station 4 Question Answer Question Answer Question Answer Question Answer 1 a 1 a x 1 a 1 a b b b b x c x c c x c d d d d 2 a 2 a x 2 a 2 a b b b b x c c c c d x d d x d 3 a 3 a 3 a x 3 a b x b b b x c c c c d d x d d 4 a 4 a 4 a x 4 a b b x b b x c x c c c d d d d Station 5 Station 6 Question Answer Question Answer 1 a 1 a b b c x c d d x e 2 a b 2 a 2 c b 1 d x c 4 d 3 3 a e 5 b x True False c 3 a X d b X c X 4 a d X b e X c f X d x 4 a 6 b 3 c 1 d 7 e 2 f 4 g 5 h 8 Name: