Sep 30, 2011

62

Which one of the following SAS statements renames two variables?


A. set work.dept1
work.dept2(rename = (jcode = jobcode sal = salary));
B. set work.dept1
work.dept2(rename = jcode = jobcode sal = salary);
C. set work.dept1
work.dept2(rename = (jcode jobcode) (sal salary));
D. set work.dept1
work.dept2(rename = (jcode = jobcode) (sal = salary));

61

A raw data file is listed below:


----|----10---|----20---|----30
John McCloskey 35 71
June Rosesette 10 43
Tineke Jones 9 37


The following SAS program is submitted using the raw data file as input:



data work.homework;
infile 'file-specification'; input name $ age height; if age LE 10;
run;

How many observations will the WORK.HOMEWORK data set contain?
A. 0
B. 2
C. 3
D. No data set is created as the program fails to execute due to errors.

60

The following SAS program is submitted:


options pageno = 1;
proc print data = sasuser.houses;
run;
proc means data = sasuser.shoes;
run;


The report created by the PRINT procedure step generates 5 pages of output. What is the page number on the first page of the report generated by the MEANS procedure step?

A. 2
B. 6
C. 5
D. 1

59

The following SAS program is submitted and reads 100 records from a raw data file:


data work.total;
infile 'file-specification' end = eof;
input name $ salary;
totsal + salary;
<insert IF statement here>
run;

Which one of the following IF statements writes the last observation to the output data set?
 A. if end = 0;
B. if eof = 0;
 C. if end = 1;
 D. if eof = 1;
 

58

The following SAS DATA step is submitted:


data work.accounting;
set work.department;
length jobcode $ 12;
run;


The WORK.DEPARTMENT SAS data set contains a character variable named JOBCODE with a length of 5.
Which one of the following is the length of the variable JOBCODE in the output data set?
 A. 8
B. 12
C. The length can not be determined as the program fails to execute due to errors.
D. 5

57

The following SAS program is submitted:


data work.totalsales;
set work.monthlysales(keep = year product sales);
retain monthsales {12} ; array monthsales {12} ; do i = 1 to 12; monthsales{i} = sales; end;
cnt + 1;
monthsales{cnt} = sales;
run;


The data set named WORK.MONTHLYSALES has one observation per month for each of five years for a total of 60 observations.


Which one of the following is the result of the above program?


A. The program runs with warnings and creates the WORK.TOTALSALES data set with 60 observations.
B. The program fails execution due to data errors.
C. The program fails execution due to syntax errors.
D. The program runs without errors or warnings and creates the WORK.TOTALSALES data set with 60 observations.

56

The following SAS program is submitted:


data work.test;
Author = 'Agatha Christie';
First = substr(scan(author,1,' ,'),1,1);
run;

Which one of the following is the length of the variable FIRST in the output data set?
A. 6
B. 200
C. 15
D. 1

55

The following SAS program is submitted:


data _null_;
set old;
put sales1 sales2;
run;


Where is the output written?


A. the raw data file that was opened last
B. the data set mentioned in the DATA statement
C. the SAS log
D. the SAS output window or an output file

54

The contents of the raw data file PRODUCT are listed below:


----|----10---|----20---|----30
24613 $25.31


The following SAS program is submitted:


data inventory;
infile 'product';
input idnum 5. @10 price;
run;


Which one of the following is the value of the PRICE variable?


A. No value is stored as the program fails to execute due to errors.
B. $25.31
C. 25.31
D. . (missing numeric value)

53

The contents of the raw data file AMOUNT are listed below:


----|----10---|----20---|----30
$1,234


The following SAS program is submitted:


data test;
infile 'amount';
input @1 salary 6.;
run;

Which one of the following is the value of the SALARY variable?
 A. 1,234
B. 1234
C. $1,234
D. . (missing numeric value)

52

The following SAS program is submitted:


data work.test;
set work.staff (keep = jansales febsales marsales);
array diff_sales{3} difsales1 - difsales3;
array monthly{3} jansales febsales marsales;
run;

Which one of the following represents the new variables that are created? A. JANSALES, FEBSALES and MARSALES
B. MONTHLY1, MONTHLY2 and MONTHLY3
C. DIFSALES1, DIFSALES2 and DIFSALES3
D. DIFF_SALES1, DIFF_SALES2 and DIFF_SALES3

51

The following SAS program is submitted:


data work.report;
set work.sales_info;
if qtr(sales_date) ge 3;
run;


The SAS data set WORK.SALES_INFO has one observation for each month in the year 2000 and the variable SALES_DATE which contains a SAS date value for each of the twelve months.


How many of the original twelve observations in WORK.SALES_INFO are written to the
WORK.REPORT data set?


A. 3
B. 6
C. 9
D. 2

50

A raw data file is listed below:


----|----10---|----20---|----30
1901 2
1905 1
1910 6
1925 .
1941 1


The following SAS program is submitted and references the raw data file above:


data coins;
infile 'file-specification';
input year quantity;
<insert statement(s) here>
run;


Which one of the following completes the program and produces a non-missing value for the variable TOTQUANTITY in the last observation of the output data set?

A. totquantity + quantity;
B. totquantity = sum(totquantity + quantity);
C. retain totquantity 0;
totquantity = totquantity + quantity;
D. totquantity 0;
sum totquantity;

49

The following SAS program is submitted:


data work.sets;
do until (prod gt 6);
prod + 1;
end;
run;


Which one of the following is the value of the variable PROD in the output data set?


A. 5
B. 8
C. 7
D. 6

48

A SAS program is submitted and the following SAS log is produced:


2 data gt100;
3 set ia.airplanes
4 if mpg gt 100 then output;
22 202
ERROR: File WORK.IF.DATA does not exist. ERROR: File WORK.MPG.DATA does not exist. ERROR: File WORK.GT.DATA does not exist. ERROR: File WORK.THEN.DATA does not exist. ERROR: File WORK.OUTPUT.DATA does not exist.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, ;, END, KEY, KEYS, NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_.
ERROR 202-322: The option or parameter is not recognized and will be ignored.


5 run;
The IA libref was previously assigned in this SAS session. Which one of the following corrects the errors in the LOG?


A. Delete the word THEN on the IF statement.
B. Add a semicolon at the end of the SET statement.
C. Add an END statement to conclude the IF statement.
 D. Place quotes around the value on the IF statement.

47

The following SAS program is submitted:


proc datasets lib = sasuser; contents data = class varnum; quit;
Which one of the following is the purpose of the VARNUM option? A. to print the total number of variables
B. to print a list of the variables in the order they were created
C. to print a list of the variables in alphabetic order
D. to print a list of variable names

46


Which one of the following SAS system options displays the time on a report? A. DATE
B. TIME
C. TODAY
D. DATETIME

45


The following SAS program is submitted:


data work.empsalary;
set work.people (in = inemp)
work.money (in = insal);
if insal and inemp;
run;


The SAS data set WORK.PEOPLE has 5 observations, and the data set WORK.MONEY has 7 observations. How many observations will the data set WORK.EMPSALARY contain?

A. 12
B. 7
C. 5
D. 0

43

A raw data record is listed below:


----|----10---|----20---|----30
Printing 750

The following SAS program is submitted:


data bonus;
infile 'file-specification';
input dept $ 1 - 11 number 13 - 15;
<insert code here>
run;


Which one of the following SAS statements completes the program and results in a value of
'Printing750' for the DEPARTMENT variable?


A. department = trim(dept) || put(number,3.);
 B. department = dept || input(number,3.);
C. department = input(dept,11.) || input(number,3.);
 D. department = trim(dept) || number;



44

The following SAS program is submitted:


proc format;
value score 1 - 50 = 'Fail'
51 - 100 = 'Pass';
run;
proc report data = work.courses nowd;
column exam;
define exam / display format = score.;
run;


The variable EXAM has a value of 50.5.
 How will the EXAM variable value be displayed in the REPORT procedure output?

A. 50.5
B. . (missing numeric value)
C. Fail
D. Pass

42

The following SAS program is submitted:


data numrecords;
infile 'file-specification'; input @1 patient $15. relative $ 16-26 @;
if relative = 'children' then input @54 diagnosis $15. @; else if relative = 'parents' then input @28 doctor $15.
clinic $ 44-53
@54 diagnosis $15. @;
input age;
run;

How many raw data records are read during each iteration of the DATA step during execution?
A. 2
B. 3
C. 4
D. 1

41

The following SAS program is submitted:


data test;
set sasuser.employees;
if 2 le years_service le 10 then

amount = 1000;
else if years_service gt 10 then amount = 2000;
else
amount = 0;
amount_per_year = years_service / amount;
run;


Which one of the following values does the variable AMOUNT_PER_YEAR contain if an employee has been with the company for one year?

A. . (missing numeric value)
B. 0
C. 1000
D. 2000

39


The contents of the raw data file EMPLOYEE are listed below:


----|----10---|----20---|----30
Ruth 39 11
Jose 32 22
Sue 30 33
John 40 44


The following SAS program is submitted:


data test;
infile 'employee';
input employee_name $ 1-4;
if employee_name = 'Sue' then input age 7-8;
else input idnum 10-11;
run;


Which one of the following values does the variable AGE contain when the name of the employee is "Sue"?

A. . (missing numeric value)
B. 33
C. 40
D. 30


Answer: C

40

The following SAS program is submitted:


data work.retail; cost = '20000'; total = .10 * cost; run;
Which one of the following is the value of the variable TOTAL in the output data set?
A. ' ' (missing character value)
B. 2000
C. '2000'
D. . (missing numeric value)

38

The following SAS program is submitted:


data work.clients;
calls = 6;
do while (calls le 6);
calls + 1;
end;
run;

Which one of the following is the value of the variable CALLS in the output data set?
A. 4
B. 6
C. 7
D. 5

37

The following SAS program is submitted and reads 100 records from a raw data file:


data work.total;
infile 'file-specification' end = eof;
input name $ salary;
totsal + salary;
<insert IF statement here>
run;

Which one of the following IF statements writes the last observation to the output data set?
A. if end = 1;
B. if eof = 1;
C. if end = 0;
D. if eof = 0;

36

The following SAS program is submitted:


<insert ODS statement here>
proc means data = sasuser.shoes;
where product in ('Sandal' , 'Slipper' , 'Boot');
run;


Which one of the following ODS statements completes the program and sends the report to an
HTML file?


A. ods html = 'sales.html';
B. ods file html = 'sales.html'; C. ods file = 'sales.html';
D. ods html file = 'sales.html';


35

The following SAS program is submitted:


data _null_;
set old (keep = prod sales1 sales2);
file 'file-specification'; put sales1 sales2; run;
Which one of the following default delimiters separates the fields in the raw data file created? A. (space)
B. : (colon)
C. , (comma)
D. ; (semicolon)

34

The following SAS program is submitted:

proc means data = sasuser.houses std mean max;
var sqfeet; run;


Which one of the following is needed to display the standard deviation with only two decimal places?

A. Add the option FORMAT = 7.2 option to the MEANS procedure statement.
B. Add the option MAXDEC = 2 to the MEANS procedure statement.
C. Add the statement MAXDEC = 7.2; in the MEANS procedure step.
D. Add the statement FORMAT STD 7.2; in the MEANS procedure step.

33

The SAS data set SASUSER.HOUSES contains a variable PRICE which has been assigned a permanent label of "Asking Price".


Which one of the following SAS programs temporarily replaces the label "Asking Price" with the label "Sale Price" in the output?

A. proc print data = sasuser.houses label;
label price "Sale Price";
run;
B. proc print data = sasuser.houses;
label price = "Sale Price";
run;
C. proc print data = sasuser.houses label = "Sale Price";
run;
D. proc print data = sasuser.houses label;
label price = "Sale Price";
run;

32

The following SAS program is submitted:


data work.totalsales (keep = monthsales{12} );
set work.monthlysales (keep = year product sales);
array monthsales {12} ; do i=1 to 12; monthsales{i} = sales; end;
run;


The data set named WORK.MONTHLYSALES has one observation per month for each of five years for a total of 60 observations.


Which one of the following is the result of the above program?


A. The program executes without errors or warnings and creates the WORK.TOTALSALES data set.
B. The program fails execution due to data errors.
C. The program executes with warnings and creates the WORK.TOTALSALES data set.
D. The program fails execution due to syntax errors.

1

The following SAS DATA step executes on Monday, April 25, 2000:


data newstaff;
set staff;
start_date = today();
run;

Which one of the following is the value of the variable START_DATE in the output data set? A. a character string with the value '04/25/2000'
B. a character string with the value 'Monday, April 25, 2000'
C. the numeric value 04252000, representing the SAS date for April 25, 2000
D. the numeric value 14725, representing the SAS date for April 25, 2000