54
The following SAS program is submitted: libname sasdata 'SAS-data-library'; data test;
set sasdata.chemists (keep = job_code); if job_code = 'chem3'
then description = 'Senior Chemist'; run;
The variable JOB_CODE is a character variable with a length of 6 bytes.
Which one of the following is the length of the variable DESCRIPTION in the output data set? A. 6 bytes B. 8 bytes C. 14 bytes D. 200 bytes 55
The following SAS program is submitted: data work.accounting;
set work.dept1 work.dept2; run;
A character variable named JOBCODE is contained in both the WORK.DEPT1 and WORK.DEPT2 SAS data sets. The variable
JOBCODE has a length of 5 in the WORK.DEPT1 data set and a length of 7 in the WORK.DEPT2 data set.
Which one of the following is the length of the variable JOBCODE in the output data set? A. 5 B. 7 C. 8 D. 12 56
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. 5 B. 8 C. 12
D. The length can not be determined as the program fails to execute due to errors.
21
57
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)); 58
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. Neither variable JCODE nor JOBCODE is written to the output data set. D. The program fails to execute due to errors. 59
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. 100 B. 110 C. 200
D. . (missing numeric value)
22
60
The following SAS program is submitted:data work.passengers; data work.passengers; if OrigPassengers = . then OrigPassengers = 100; TransPassengers = 100; OrigPassengers = .; NonPaying = 10;
TotalPassengers = OrigPassengers + TransPassengers; run;
Which one of the following is the value of the TOTALPASSENGERS variable in the output data set? A. 100 B. 110 C. 200
D. . (missing numeric value) 61
The following SAS program is submitted: data work.staff; JobCategory = 'FA'; JobLevel = '1';
JobCategory = JobCategory || JobLevel; run;
Which one of the following is the value of the variable JOBCATEGORY in the output data set? A. FA B. FA1 C. FA 1
D. ' ' (missing character value) 62
The following SAS program is submitted: data work.one; x = 3; y = 2; z = x ** y; run;
Which one of the following is the value of the variable Z in the output data set? A. 6 B. 9
C. . (missing numeric value)
D. The program fails to execute due to errors.
23
63
The SAS data set named WORK.TEST is listed below: capacity airplanetype staff 150 Large 10
Which one of the following SAS programs created this data set? A. data work.test; capacity = 150;
if 100 le capacity le 200 then
airplanetype = 'Large' and staff = 10; else airplanetype = 'Small' and staff = 5; run;
B. data work.test; capacity = 150;
if 100 le capacity le 200 then do;
airplanetype = 'Large'; staff = 10; end; else do;
airplanetype = 'Small'; staff = 5; end; run;
C. data work.test; capacity = 150;
if 100 le capacity le 200 then do;
airplanetype = 'Large'; staff = 10; else do;
airplanetype = 'Small'; staff = 5; end; run;
D. data work.test; capacity = 150;
if 100 le capacity le 200 then; airplanetype = 'Small'; staff = 5; else;
airplanetype = 'Large'; staff = 10;
24
run; 64
The following SAS program is submitted: data work.flights; destination = 'cph'; select(destination);
when('LHR') city = 'London'; when('CPH') city = 'Copenhagen'; otherwise city = 'Other'; end; run;
Which one of the following is the value of the CITY variable? A. Other B. Copenh C. Copenhagen
D. ' ' (missing character value) 65
The following SAS program is submitted: data work.flights; destination = 'CPH'; select(destination);
when('LHR') city = 'London'; when('CPH') city = 'Copenhagen'; otherwise; end; run;
Which one of the following is the value of the CITY variable? A. London B. Copenh C. Copenhagen
D. ' ' (missing character value) 66
The following SAS program is submitted: data work.new; length word $7; amount = 4;
if amount = 4 then word = 'FOUR';
else if amount = 7 then word = 'SEVEN'; else word = 'NONE!!!'; amount = 7;
25