IT 433 Final Exam. June 9, 2014

Similar documents
Base and Advance SAS

Chapter 2: Getting Data Into SAS

SAS CURRICULUM. BASE SAS Introduction

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

Reading data in SAS and Descriptive Statistics

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

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

ssh tap sas913 sas

Final Stat 302, March 17, 2014

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

(c) What is the result of running the following program? x = 3 f = function (y){y+x} g = function (y){x =10; f(y)} g (7) Solution: The result is 10.

INTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS

Stat 302 Statistical Software and Its Applications SAS: Data I/O

work.test temp.test sasuser.test test

CHAPTER 7 Using Other SAS Software Products

AA BB CC DD EE. Introduction to Graphics in R

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

SAS PROGRAMMING AND APPLICATIONS (STAT 5110/6110): FALL 2015 Module 2

AURA ACADEMY SAS TRAINING. Opposite Hanuman Temple, Srinivasa Nagar East, Ameerpet,Hyderabad Page 1

ECLT 5810 SAS Programming - Introduction

The INPUT Statement: Where It

Level I: Getting comfortable with my data in SAS. Descriptive Statistics

Stat 302 Statistical Software and Its Applications SAS: Data I/O & Descriptive Statistics

17. Reading free-format data. GIORGIO RUSSOLILLO - Cours de prépara)on à la cer)fica)on SAS «Base Programming» 386

SAS Macros for Grouping Count and Its Application to Enhance Your Reports

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

Getting Familiar with SAS Version 8.2 and 9.0 Enhancements Sunil K. Gupta, Gupta Programming, Simi Valley, CA

proc print data=account; <insert statement here> run;

Program Validation: Logging the Log

Sample Questions. SAS Advanced Programming for SAS 9. Question 1. Question 2

data Vote; /* Read a CSV file */ infile 'c:\users\yuen\documents\6250\homework\hw1\political.csv' dsd; input state $ Party $ Age; run;

Taming a Spreadsheet Importation Monster

Dictionary.coumns is your friend while appending or moving data

Data Acquisition and Integration

BUSINESS ANALYTICS. 96 HOURS Practical Learning. DexLab Certified. Training Module. Gurgaon (Head Office)

DSCI 325: Handout 2 Getting Data into SAS Spring 2017

SAS Certification Handout #7: Ch

Moving Data and Results Between SAS and Excel. Harry Droogendyk Stratia Consulting Inc.

Stat 302 Statistical Software and Its Applications SAS: Working with Data

Certkiller.A QA

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

T.I.P.S. (Techniques and Information for Programming in SAS )

How to use UNIX commands in SAS code to read SAS logs

Merge Processing and Alternate Table Lookup Techniques Prepared by

An Easy Way to Split a SAS Data Set into Unique and Non-Unique Row Subsets Thomas E. Billings, MUFG Union Bank, N.A., San Francisco, California

Statistical Programming with R

STAT:5400 Computing in Statistics. Other software packages. Microsoft Excel spreadsheet very convenient for entering data in flatfile

Introduction to R 21/11/2016

CH5: CORR & SIMPLE LINEAR REFRESSION =======================================

Untangling and Reformatting NT PerfMon Data to Load a UNIX SAS Database With a Software-Intelligent Data-Adaptive Application

Demystifying Inherited Programs

Sandra Hendren Health Data Institute

/* CalcESLs.sas */ /* */ /* Created 02 January 2006 by Sarah Gilman */ /* report errors to

Chapter 9: Working With Data

IST 3108 Data Analysis and Graphics Using R Week 9

Simplifying Your %DO Loop with CALL EXECUTE Arthur Li, City of Hope National Medical Center, Duarte, CA

Midterm Exam Answers Instructor: Randy Shepherd CSCI-UA.0201 Spring 2017

Create a Format from a SAS Data Set Ruth Marisol Rivera, i3 Statprobe, Mexico City, Mexico

Getting Your Data into SAS The Basics. Math 3210 Dr. Zeng Department of Mathematics California State University, Bakersfield

Draft. Students Table. FName LName StudentID College Year. Justin Ennen Science Senior. Dan Bass Management Junior

Writing Programs in SAS Data I/O in SAS

Introduction to SAS. Cristina Murray-Krezan Research Assistant Professor of Internal Medicine Biostatistician, CTSC

The Programmer's Solution to the Import/Export Wizard

Relational Database Management Systems for Epidemiologists: SQL Part I

Introduction to DATA Step Programming SAS Basics II. Susan J. Slaughter, Avocet Solutions

Using Dynamic Data Exchange

SAS Certification Handout #6: Ch

LECTURE NOTES FOR ECO231 COMPUTER APPLICATIONS I. Part Two. Introduction to R Programming. RStudio. November Written by. N.

Vendor: SAS Institute. Exam Code: A Exam Name: SAS Advanced Programming Exam for SAS 9. Version: Demo

PROC FORMAT. CMS SAS User Group Conference October 31, 2007 Dan Waldo

Math 355: Linear Algebra: Midterm 1 Colin Carroll June 25, 2011

SAS Online Training: Course contents: Agenda:

SAS Graphics & Code. stat 480 Heike Hofmann

A SAS Macro for Producing Benchmarks for Interpreting School Effect Sizes

Introduction to R: Data Types

An Introduction to SAS Macros

ABSTRACT INTRODUCTION MACRO. Paper RF

ZIPpy Safe Harbor De-Identification Macros

LAB #1: DESCRIPTIVE STATISTICS WITH R

An Introduction to SAS University Edition

Introduction to DATA Step Programming: SAS Basics II. Susan J. Slaughter, Avocet Solutions

Model Question Paper. Credits: 4 Marks: 140

Extremely short introduction to R Jean-Yves Sgro Feb 20, 2018

SAS and Python: The Perfect Partners in Crime

Introductory Guide to SAS:

From Manual to Automatic with Overdrive - Using SAS to Automate Report Generation Faron Kincheloe, Baylor University, Waco, TX

SAS System Powers Web Measurement Solution at U S WEST

Use That SAP to Write Your Code Sandra Minjoe, Genentech, Inc., South San Francisco, CA

Stats with R and RStudio Practical: basic stats for peak calling Jacques van Helden, Hugo varet and Julie Aubert

STAT 7000: Experimental Statistics I

Control Flow Structures

Graphics - Part III: Basic Graphics Continued

%MAKE_IT_COUNT: An Example Macro for Dynamic Table Programming Britney Gilbert, Juniper Tree Consulting, Porter, Oklahoma

Using DDE with Microsoft Excel and SAS to Collect Data from Hundreds of Users

SC-15. An Annotated Guide: Using Proc Tabulate And Proc Summary to Validate SAS Code Russ Lavery, Contractor, Ardmore, PA

Fname A variable character field up to 15 characters in length. Must have a value Lname A variable character field up to 15

Write SAS Code to Generate Another SAS Program A Dynamic Way to Get Your Data into SAS

INTRODUCTION TO R. Basic Graphics

ST Lab 1 - The basics of SAS

Contents of SAS Programming Techniques

Transcription:

Page 1 of 10 IT 433 Final Exam June 9, 2014 Part A: Multiple Choice Questions about SAS. Circle the most correct answer for each question. You may give an optional reason for each answer; if the answer is correct, the reason will not be considered. Give a reason for possible partial credit if you are not sure of your answer. 5 points each. Do all 20 questions. 1. Which of the following SAS statements reads the next observation from a permanent dataset into the currently executing dataset? a. input pets.dogs; b. load pets.dogs; c. read pets.dogs; d. set pets.dogs; 2. Which statement is executable in a SAS data step? (The opposite of executable is declarative.) a. drop b. input c. label d. retain 3. What does +3 do in a SAS data step? a. Adds 3 to the most recently modified variable. b. Moves the column pointer 3 columns to the right. c. Moves the column pointer to column 3. d. Skips 3 lines. 4. What is an encoding? a. An encryption system that prevents unauthorized access to SAS permanent datasets. b. A representation of each character in a text file with a sequence of binary bits. c. The representation of data in a SAS permanent dataset. d. The representation of a floating point value in a SAS permanent dataset. 5. Which x variable has a value of 1 at the end of an input file? a. end = x b. obs = x c. eof = x d. lastobs = x 6. Which of the following indicates a character variable of length 8 in list style input, if the length of the variable is not changed.? a. @ b. $ c. $8. d. $CHAR8. 7. What is the concatenation operator in SAS? a. & b. + c. d. %% 8. What is the name for a dataset in a dataset step if no actual dataset is to be generated? a. default b. empty c. missover d. _null_

Page 2 of 10 9. If the dataset one contains 15 observations and the dataset two contains 12 observations, how many observations do the datasets combined1 and combined2 contain, respectively, after these data steps execute? data combined1; data combined2; set one; set one two; set two; a. 12; 15 b. 12; 27 c. 15; 27 d. 27; 12 10. The following SAS data step is executed. data testds; do i = 1 to 3; input x y @; output; end; datalines; 3 5 2 1 4 2 3 5 How many observations are in the resulting dataset testds? a. 1 b. 2 c. 3 d. 4 11. What is the value of date in the SAS dataset testdate? data testdate; date = '3feb1960'd; date = date + 2; a. 2 b. 4 c. 35 d. 36 12. The following SAS data step is submitted: data test; infile 'c:\mydata.dat' dlm='$' dsd ; input accnum $ fname $ lname $; What does dsd mean in the infile statement? a. Do not treat $ characters as part of the data fields, instead treat them as delimiters. b. If a data value is specified in quotes with embedded $ characters, treat it as part of the data field. c. Treat a data value delimited by two $ characters as character data. d. Treat two consecutive $ characters as a missing value for the variable read. 13. Which statement defines the array variable population in a dataset? a. array population(50) 10.; b. array float population[50]; c. array opulation{50}; d. array population{50} state1-state30 city1-city20;

14. The datafile 'c:\mydata.dat' contains account number, the first name, and the last name of account holders. Here are the first three lines of this data file: 122232 Craig Smith 142434 Thomas 152535 Dan Paul Which data step below correctly reads the data in the input file into the dataset test? Page 3 of 10 a. data test; infile 'c:\mydata.dat'; input accnum $ fname $ lname $; b. data test; infile 'c:\mydata.dat' truncover; input accnum $ fname $ lname $; c. data test; infile 'c:\mydata.dat' missover; input accnum $ 1-6 fname $ 8-12 lname $ 14-18; d. data test; infile 'c:\mydata.dat' truncover; input accnum $ 1-6 fname $ 8-12 lname $ 14-18; 15. The following SAS program is submitted: proc format; value score 1-50 = 'Fail' 51-100 = 'Pass'; Which print procedure uses this format correctly? a. proc print data = district12.class; var test; format test score; b. proc print data = district12.class; var test; format test score.; c. proc print data = district12.class format = score; var test; d. proc print data = sasuser.class format = score.; var test;

Page 4 of 10 16. Which SQL procedure program deletes the data set one? a. proc sql; drop table one; b. proc sql; remove table one; c. proc sql; delete table one; d. proc sql; delete from one; 17. The following proc sql is executed: proc sql; select gender, mean(age) from patients where admit_date < '1apr2014'd group by gender; What are the equivalent statements in traditional SAS if the observations are not assumed to be sorted by gender? a. proc means data = patients mean; where admit_date < '1apr2014'd; by gender; var age; b. proc means data = patients; where age < '1apr2014'd; class age; var age; c. proc means data = patients; where age < '1apr2014'd; sort by age; var age; d. proc means data = patients; where age < 18; sort by gender; var age mean; 18. Which procedure assigns a dataset variable value to a macro variable? a. %let b. macro_assign c. %set d. symput

Page 5 of 10 19. The following statements are executed: data phone_nums; merge patients doctors; by doc_id; keep patient_name doc_name doc_phone; proc sort; by patient_name; proc print data = phone_nums; How are these statements written using proc sql? a. proc sql; select patient_name, doc_name, doc_phone from patients, doctors where patients.doc_id = doctors.doc_id order by patient_name; b. proc sql; select patient_name, doc_phone from patients, doctors where patients.docid = doctors.docid; c. proc sql; select patient_name, doc_name, doc_phone from patients, doctors where doc_id = doc_id order by patient_name; d. proc sql; select patient_name, doc_name, doc_phone from patients, doctors order by patient_name; 20. The following program is submitted %let a = cat; %let dsname = _null_; %macro animal(a = frog, dsname = ); data _null_; file 'test.txt'; animal_type = "&a"; put animal_type; %mend; %let a = bird; %animal(a = &a, dsname = _null_) What is written to the output file test.txt? a. &a b. bird c. cat d. dog e. frog

Page 6 of 10 Part B: Multiple Choice Questions about R. Circle the most correct answer for each question. You may give an optional reason for each answer; if the answer is correct, the reason will not be considered. Give a reason for possible partial credit if you are not sure of your answer. 5 points each. Do all 20 questions. 21. What does the function call numeric(0) return? a. [1] 0 b. A numeric vector of length 0. c. [1] FALSE d. [1] TRUE 22. What is the result of evaluating: 0 / 0 a. [1] Inf b. [1] NA c. [1] NaN d. [1] NULL 23. What is the return value from as.logical(0)? a. [1] FALSE b. [1] NA c. [1] TRUE d. A logical vector of length 0. 24. What does the function call c(3, "3", TRUE)return? a. c(3, "3", TRUE) b. c("3", "3", "1") c. c("3", "3", "TRUE") d. c(3, "3", TRUE) 25. What is the output? print(apply(rbind(diag(c(1, 7, 13)), diag(3)), 2, sum)) a. [1] 1 4 7 b. [1] 1 7 13 1 1 1 c. [1] 2 8 14 d. [1] 24 26. What is printed? print(substr(c("elephant", "rhinocerous"), c(2, 5), c(5, 7))) a. [1] "an" "oceous" b. [1] "e" "r" c. [1] "leph" "oce" d. [1] "lepha" "ocerous" 27. (This problem may be confusing; do the best you can.) The functions f and g are defined as follows: f <- function(a) { return (function(h) { return(h(a)) } ) } g <- function(y) { return(2 * y + 5) } What is printed? print(f(6)(g)) a. [1] 10 b. [1] 11 c. [1] 17 d. Error, h not found. 28. Which function is used to remove one or more objects from the R workspace? a. delete b. detach c. remove d. rm 29. What does the System.time function return? a. A data frame b. A vector with named components c. A matrix d. A vector with one floating point value.

Page 7 of 10 30. Which plot could plausibly be produced by this script? x = rnorm(100) u = rnorm(100) y = (-0.8) * x + sqrt(1 - (0.8 ** 2)) * u plot(x, y, pch=20) 31. The following object is defined: obj <- list(a=c(1, 2, 3), c("a", "b"), b=c(true, FALSE, FALSE)) Which of the following returns [1] FALSE? a. obj$a[1] b. length(obj[[2]]) == 2 c. is.logical(obj[[2]]) d. is.list(obj) 32. If df is a data frame object with 5 rows, which expression selects rows 1, 2, and 5 from df? a. df[,c(-2, -3)] b. df[c(-3, -5), ] c. df[c(t, T, F, F, T), ] d. df[,c(t, T, T, F, F)]

Page 8 of 10 33. What is printed by print(qunif(0.75, 5, 9))? a. [1] 3 b. [1] 6 c. [1] 7.5 d. [1] 8 34. What is printed by print(pnorm(-2))? a. [1] 0.02275013 b. [1] 0.04550026 c. [1] 0.9544997 d. [1] 0.9772499 35. Which is the most plausable return value from mean(rexp(1000, 2))? a. [1] 0.5 b. [1] 0.5052291 b. [1] 1.981683 d. [2] 2 36. The following script is executed? df <- data.frame(x=c(3, 4, 3, 2, 3, 1), s=c(1, 2, 1, 2, 1, 2), t=c(1, 1, 1, 2, 2, 2)) print(aggregate(df$x, df[, -1], FUN=mean)) What is printed? a. b. c. d. s t x s t x s t x s t x 1 1 2 3.0 1 1 1 4 1 1 1 3.0 1 1 1 6 2 1 2 4.0 2 2 1 6 2 2 1 4.0 2 2 1 8 3 1 2 3.0 3 1 2 6 3 1 2 3.0 3 1 2 6 4 1 2 1.5 4 2 2 4 4 2 2 1.5 4 2 2 3 37. Which of the following causes four R plots to be plotted on each page? a. mfrow(2, 2) b. par(mfrow(2, 2)) c. par(mfrow(c(2, 2)) d. par(mfrow = c(2, 2)) 38. The following R statement is executed: print(x) This output is printed: [1] A E D Levels: A B C D E What kind of object is x? a. character b. data.frame c. factor d. ts

39. What is plotted? a <- c(2, 1, 3, 1, 2, 2) barplot(table(a), xlab="level", ylab="count", ylim=c(0, 3)) Page 9 of 10

Page 10 of 10 40. The following R statements are executed: plot(1, 1, xlim=c(1, 5), ylim=c(1, 5), type="n", xlab="", ylab="") x <- c(1.5, 2.0, 2.5) y <- c(3.75, 4.25, 3.75) lines(x, y, lwd=4) x <- c(3.5, 4, 4.5) y <- c(3.75, 4.25, 3.75) lines(x, y, lwd=4) x <- c(3, 3) y <- c(2.75, 3.25) lines(x, y, lwd=4) x <- c(2.5, 3.5) y <- c(2, 2) lines(x, y, lwd=4) What is the resulting plot?