Вы находитесь на странице: 1из 6

Business & Decision Ltd.

SAS Test Answer sheet with marking scheme

PART 1 Q1 What does the KEEP statement do? A1 Q2 A2 Q3 A3 Q4 Is there any difference between the created bookings1 and bookings2 tables created by the following data steps? data bookings1; set database.bookings; where booking_date gt '01jan2003'd; run; and data bookings2; set database.bookings(where=(booking_date gt '01jan2003'd)); run; A4 Q5 A5 Q6 A6 Q7 A7 What does this statement do? String = put(date,date9.); What does the nodupkey option do on a PROC SORT? Give two potential benefits of using the KEEP statement?

Name two other statements that also have the same effect as the keep statement in either standard SAS or SQL

What is the INTCK() function used for? e.g. number = intck('month','01jan2000'd,'01jan2003'd);

Page 1 of 6

Business & Decision Ltd.

SAS Test Answer sheet with marking scheme

Q8

Is there any difference between the tables bookings1 and bookings2 created by the following steps?: data bookings1; set database.bookings; where booking_type eq: 'c'; run; proc sql; create table bookings2 as select * from database.bookings where ( (booking_type like 'c%') ); quit;

A8 Q9 A9 Q10 A10 Q11 A11 Q12 A12 Q13 A13 What does PROC FORMAT do? What does PROC APPEND do?

Why might you use PROC CONTENTS?

Suggest two ways to delete a SAS dataset within a SAS program either using standard Base SAS or SQL

Give two ways a format can be used

Q14

What would the following PROC FREQ give you?: proc freq data=color; weight count; tables eyes hair eyes*hair/ outexpect sparse; run;

A14 Q15 A15 Q16 Name three major report generating PROCs in BASE SAS

Name three major analytical PROCs in Base SAS

Page 2 of 6

Business & Decision Ltd.

SAS Test Answer sheet with marking scheme

A16 Q17 What is the difference between the following: array dates{10} 4 date1-date10; and array dates(10) 4 _temporary_; A17

Q18

Related to Q17, what is the following doing? do n=1 to dim(dates); dates(n) = .; end;

A18 Q19 A19 Q20 A20 Q21 What is happening in the following procedure: proc copy in=database out=sasuser; select b:; run; A21 Q22 A22 Q23 A23 Q24 A24 What does the COMPRESS option do? What does the RETAIN statement do?

Which PROC would you use to re-shape you data so that rows become columns and vice-versa?

Give two ways of renaming a column either in a data step or in SQL?

Give one way of restricting the number of observations returned from a data step.

Page 3 of 6

Business & Decision Ltd.

SAS Test Answer sheet with marking scheme

Q25

What is contained in the my_output table? data mydata; set database.customer; x = ranuni(1234); run; proc sort data=mydata; by x; run; data my_output; set mydata(obs=10000); run;

A25 Q26 What do the following functions do? Abs Compress Compbl Date() Day Input Max, Min, Mean Substr Scan Time() Abs Compress Compbl Date() Day Input Max, Min, Mean Substr Scan Time() What does the %include statement do?

A26

Q27 A27 Q28

Suggest an efficient alternative to the following: if () then ; else if () then ; else if () then ; else if () then ; else ;

A28 Q29 What does the OBS=1000 options do?

Page 4 of 6

Business & Decision Ltd.

SAS Test Answer sheet with marking scheme

A29 Q30 I have run some code and get the following error, what could I do to fix this problem? 77 proc format library=sasuser; 78 value number 79 1 = 'One' 80 other = 'Two+' 81 ; NOTE: Format NUMBER is already on the library. NOTE: Format NUMBER has been written to SASUSER.FORMATS. 82 run; NOTE: PROCEDURE FORMAT used: real time 0.01 seconds cpu time 0.01 seconds 83 84 85 86

data sasuser.mydata; format number number.; ------48 ERROR 48-59: The format NUMBER was not found or could not be loaded. 87 88 89 90 do number=1 to 10; output; end; run;

NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set SASUSER.MYDATA may be incomplete. When this step was stopped there were 0 observations and 1 variables. WARNING: Data set SASUSER.MYDATA was not replaced because this step was stopped. NOTE: DATA statement used: real time 0.01 seconds cpu time 0.01 seconds A30

Page 5 of 6

Business & Decision Ltd.

SAS Test Answer sheet with marking scheme

Page 6 of 6