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

Aug 10, 2011

30

Which one of the following ODS statement options terminates output being written to an HTML
file?


A. END
B. STOP
C. QUIT
D. CLOSE

Answer: D

29

The following SAS program is submitted:


data work.total;
set work.salary(keep = department wagerate);
by department;
if first.department then payroll = 0;
payroll + wagerate; if last.department; run;


The SAS data set WORK.SALARY, currently ordered by DEPARTMENT, contains 100 observations for each of 5 departments.


Which one of the following represents how many observations the WORK.TOTAL data set contains?

A. 500
B. 5
C. 20
D. 100


Answer: B

28

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


----|----10---|----20---|----30
Janice 10
Henri 11
Michael 11
Susan 12


The following SAS program is submitted:


data group;
infile 'team';
input name $15. age 2.;
file 'file-specification';
put name $15. +5 age 2.;
run;

Which one of the following describes the output created?

A. a raw data file only
B. No output is generated as the program fails to execute due to errors.
C. a SAS data set named GROUP only
D. a SAS data set named GROUP and a raw data file


Answer: D

26


Which one of the following statements is true regarding the SAS automatic _ERROR_ variable?


A. The _ERROR_ variable can be used in expressions or calculations in the DATA step.
B. The _ERROR_ variable contains the values 'TRUE' or 'FALSE'.
C. The _ERROR_ variable contains the values 'ON' or 'OFF'.
D. The _ERROR_ variable is automatically stored in the resulting SAS data set.


Answer: A

25

A realtor has two customers. One customer wants to view a list of homes selling for less than
$60,000. The other customer wants to view a list of homes selling for greater than $100,000.


Assuming the PRICE variable is numeric, which one of the following PRINT procedure steps will select all desired observations?

A. proc print data = sasuser.houses; where price lt 60000 and price gt 100000; run;
B. proc print data = sasuser.houses; where price lt 60000 or price gt 100000; run;
C. proc print data = sasuser.houses;
where price lt 60000 or where price gt 100000;
run;
D. proc print data = sasuser.houses;
where price lt 60000; where price gt 100000; run;

Answer: B

24

The following SAS program is submitted:


data work.passengers;
if OrigPassengers = . then OrigPassengers = 100; TransPassengers = 100;
OrigPassengers = .;
NonPaying = 10;
TotalPassengers = sum (OrigPassengers, TransPassengers);
run;


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

A. 200
B. . (missing numeric value)
C. 110
D. 100


Answer: D

22


The following SAS program is submitted:


data work.test;
First = 'Ipswich, England';
City = substr(First,1,7); City_Country = City!!', '!!'England';
run;

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

A. Ipswich , England
B. Ipswich, 'England'
C. Ipswich, England
D. Ipswich!!

Answer: A

21

The following SAS program is submitted:


data work.month;
date = put('13mar2000'd,ddmmyy10.);
run;

Which one of the following represents the type and length of the variable DATE in the output data set?

A. numeric, 8 bytes
B. character, 10 bytes
C. character, 8 bytes
D. numeric, 10 bytes

Answer: B

20

The following SAS program is submitted:


data stats;
set revenue;
array weekly{5} mon tue wed thu fri;
<insert DO statement here> total = weekly{i} * .25; output;
end;
run;


Which one of the following DO statements completes the program and processes the elements of the WEEKLY array?

A. do weekly{i} = 1 to 5;
B. do i = 1 to 5;
C. A DO loop cannot be used because the variables referenced do not end in a digit.
D. do i = mon tue wed thu fri;

17

The following SAS program is submitted:


libname temp 'SAS-data-library';
data work.new;
set temp.jobs;
format newdate mmddyy10.;
qdate = qtr(newdate);
ddate = weekday(newdate);
run;
proc print data = work.new;
run;
The variable NEWDATE contains the SAS date value for April 15, 2000. What output is produced if April 15, 2000 falls on a Saturday?


A. Obs newdate qdate ddate
1 APR152000 2 6

B. Obs newdate qdate ddate
1 04/15/2000 2 6

C. Obs newdate qdate ddate
1 APR152000 2 7

D. Obs newdate qdate ddate
1 04/15/2000 2 7

16


The SASDATA.BANKS data set has five observations when the following SAS program is submitted:


libname sasdata 'SAS-data-library';
data allobs;
set sasdata.banks;
capital=0;
do year = 2000 to 2020 by 5; capital + ((capital+2000) * rate); output;
end;
run;

How many observations will the ALLOBS data set contain?

A. 25
B. 15
C. 20
D. 5

15

Which one of the following is true of the RETAIN statement in a SAS DATA step program?

A. It is only valid in conjunction with a SUM function.
B. It has no effect on variables read with the SET, MERGE and UPDATE statements.
C. It adds the value of an expression to an accumulator variable and ignores missing values.
D. It can be used to assign an initial value to _N_ .

14

The following SAS program is submitted:


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

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

A. C
B. A
C. Agatha
D. ' ' (missing character value)

13

The following SAS program is submitted:


data allobs;
set sasdata.origin (firstobs = 75 obs = 499);
run;
The SAS data set SASDATA.ORIGIN contains 1000 observations. How many observations does the ALLOBS data set contain?


A. 499
B. 1000
C. 424
D. 425

Trickiest question i have faced

The following SAS program is submitted:


footnote1 'Sales Report for Last Month'; footnote2 'Selected Products Only'; footnote3 'All Regions';
footnote4 'All Figures in Thousands of Dollars';


proc print data = sasuser.shoes;
footnote2 'All Products';
run;

Which one of the following contains the footnote text that is displayed in the report?

A. Sales Report for Last Month
All Products
All Regions
All Figures in Thousands of Dollars

B. All Products
All Regions
All Figures in Thousands of Dollars

C. Sales Report for Last Month
All Products

D. All Products

10

The following SAS program is submitted:

data work.company;
set work.dept1(keep = jobcode) work.dept2(rename = (jcode = jobcode));
run;

Which one of the following is the result?

A. The variable JCODE is written to the output data set.
B. The variable JOBCODE is written to the output data set.
C. The program fails to execute due to errors.
D. Neither variable JCODE nor JOBCODE is written to the output data set.
The following SAS program is submitted:


data work.january;
set work.allmonths (keep = product month num_sold cost);
if month = 'Jan' then output work.january;
sales = cost * num_sold;
keep = product sales;
run;

Which variables does the WORK.JANUARY data set contain?
A. PRODUCT and SALES only
B. An incomplete output data set is created due to syntax errors.
C. PRODUCT, MONTH, NUM_SOLD and COST only
D. PRODUCT, SALES, MONTH, NUM_SOLD and COST only

8

The following SAS program is submitted:


data work.total;
set work.salary(keep = department wagerate);
by department;
if first.department then payroll = 0;
payroll + wagerate; if last.department; run;


The SAS data set named WORK.SALARY contains 10 observations for each department, currently ordered by DEPARTMENT.


Which one of the following is true regarding the program above?


A. FIRST.DEPARTMENT and LAST.DEPARTMENT are variables in the WORK.TOTAL data set.
B. The values of the variable PAYROLL represent the total for each department in the WORK.SALARY data set.
C. The BY statement in the DATA step causes a syntax error.
D. The values of the variable PAYROLL represent a total for all values of WAGERATE in the
WORK.SALARY data set.

7

Which one of the following is true when SAS encounters a data error in a DATA step?


A. The DATA step stops executing at the point of the error, and the resulting DATA set contains observations up to that point.
B. A note appears in the SAS log that the incorrect data record was saved to a separate SAS file for further examination.
C. The DATA step stops executing at the point of the error, and no SAS data set is created.
D. A note is written to the SAS log explaining the error, and the DATA step continues to execute.

Q5

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.;
if _error_ then description = 'Problems';
else description = 'No Problems';
run;

Which one of the following is the value of the DESCRIPTION variable?
A. No Problems
B. Problems
C. The value can not be determined as the program fails to execute due to errors.
D. ' ' (missing character value)

Q3.


When the following SAS program is submitted:


data work.sales;
do year = 1 to 5;
do month = 1 to 12;
x + 1;
end;
run;


Which one of the following represents how many observations are written to the WORK.SALES
data set?


A. 5
B. 60
C. 1
D. 0