Wednesday, December 20, 2006

Base SAS 33

The SAS data set BANKS is listed below:
BANKS
name rate
FirstCapital 0.0718
DirectBank 0.0721
VirtualDirect 0.0728
The following SAS program is submitted:
data newbank;
do year = 1 to 3;
set banks;
capital + 5000;
end;
run;
Which one of the following represents how many observations and variables will exist in the SAS data set NEWBANK?
A. 0 observations and 0 variables
B. 1 observations and 4 variables
C. 3 observations and 3 variables
D. 9 observations and 2 variables
Click Comment link to get answer

Base SAS 34

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. 5
C. 6
D. 7
Click Comment link to get answer

Base SAS 35

The following SAS program is submitted:
data work.pieces;
do while (n lt 6);
n + 1;
end;
run;
Which one of the following is the value of the variable N in the output data set?
A. 4
B. 5
C. 6
D. 7
Click Comment link to get answer

Base SAS 36

The following SAS program is submitted:
data work.sales;
do year = 1 to 5;
do month = 1 to 12;
x + 1;
end;
end;
run;
Which one of the following represents how many observations are written to the WORK.SALES data set?
A. 0
B. 1
C. 5
D. 60
Click Comment link to get answer

Base SAS 37

A raw data record is listed below:
--------10-------20-------30
1999/10/25
The following SAS program is submitted:
data projectduration;
infile 'file-specification';
input date $ 1 - 10;

run;
Which one of the following statements completes the program above and computes the duration of the project in days as of today's
date?
A. duration = today( ) - put(date,ddmmyy10.);
B. duration = today( ) - put(date,yymmdd10.);
C. duration = today( ) - input(date,ddmmyy10.);
D. duration = today( ) - input(date,yymmdd10.);
Click Comment link to get answer

Base SAS 38

A raw data record is listed below: (Question updated: underscores means blank spaces)
--------10-------20-------30
Printing___750
The following SAS program is submitted:
data bonus;
infile 'file-specification';
input dept $ 1 - 11 number 13 - 15;

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) number;
B. department = dept input(number,3.);
C. department = trim(dept) || put(number,3.);
D. department = input(dept,11.) || input(number,3.);
Click Comment link to get answer

Base SAS 39

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. numeric, 10 bytes
C. character, 8 bytes
D. character, 10 bytes
Click Comment link to get answer

Tuesday, December 19, 2006

Base SAS 40

The following SAS program is submitted:
data work.month;
date = input('13mar2000',date9.);
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. numeric, 9 bytes
C. character, 8 bytes
D. character, 9 bytes
Click Comment link to get answer

Base SAS 41

The following SAS program is submitted:
data work.products;
Product_Number = 5461;
Item = '1001';
Item_Reference = Item'/'Product_Number;
run;
Which one of the following is the value of the variable ITEM_REFERENCE in the output data set?
A. 1001/5461
B. 1001/ 5461
C. . (missing numeric value)
D. The value can not be determined as the program fails to execute due to errors.
Click Comment link to get answer

Base SAS 42

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. 2000
B. '2000'
C. . (missing numeric value)
D. ' ' (missing character value)
Click Comment link to get answer

Base SAS 43

Which one of the following SAS statements correctly computes the average of four numerical values?
A. average = mean(num1 - num4);
B. average = mean(of num1 - num4);
C. average = mean(of num1 to num4);
D. average = mean(num1 num2 num3 num4);
Click Comment link to get answer

Base SAS 44

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. 1
B. 6
C. 15
D. 200
Click Comment link to get answer

Base SAS 45

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. A
B. C
C. Agatha
D. ' ' (missing character value)
Click Comment link to get answer

Base SAS 46

The following SAS program is submitted:
data work.test;
Title = 'A Tale of Two Cities, Charles J. Dickens';
Word = scan(title,3,' ,');
run;
Which one of the following is the value of the variable WORD in the output data set?
A. T
B. of
C. Dickens
D. ' ' (missing character value)
Click Comment link to get answer

Base SAS 47

The following SAS program is submitted:
data work.test;
First = 'Ipswich, England';
City_Country = substr(First,1,7)!!', '!!'England';
run;
Which one of the following is the length of the variable CITY_COUNTRY in the output data set?
A. 6
B. 7
C. 17
D. 25
Click Comment link to get answer

Base SAS 48

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!!
B. Ipswich, England
C. Ipswich, 'England'
D. Ipswich , England
Click Comment link to get answer

Base SAS 49

Which one of the following is true of the RETAIN statement in a SAS DATA step program?
A. It can be used to assign an initial value to _N_ .
B. It is only valid in conjunction with a SUM function.
C. It has no effect on variables read with the SET, MERGE and UPDATE statements.
D. It adds the value of an expression to an accumulator variable and ignores missing values.
Click Comment link to get answer

Base SAS 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;

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. totquantity 0;
sum totquantity;
D. retain totquantity 0;
totquantity = totquantity + quantity;
Click Comment link to get answer

Base SAS 51

A raw data file is listed below:
--------10-------20-------30
squash 1.10
apples 2.25
juice 1.69
The following SAS program is submitted using the raw data file above:
data groceries;
infile 'file-specification';
input item $ cost;

run;
Which one of the following completes the program and produces a grand total for all COST values?
A. grandtot = sum cost;
B. grandtot = sum(grandtot,cost);
C. retain grandtot 0;
grandtot = sum(grandtot,cost);
D. grandtot = sum(grandtot,cost);
output grandtot;
Click Comment link to get answer

Base SAS 52

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. 5
B. 20
C. 100
D. 500
Click Comment link to get answer

Base SAS 53

Base SAS

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. The BY statement in the DATA step causes a syntax error.
B. FIRST.DEPARTMENT and LAST.DEPARTMENT are variables in the WORK.TOTAL data set.
C. The values of the variable PAYROLL represent the total for each department in the WORK.SALARY data set.
D. The values of the variable PAYROLL represent a total for all values of WAGERATE in the WORK.SALARY data set.
Click Comment link to get answer
Click Comment link to get answer

Base SAS 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
Click Comment link to get answer

Base SAS 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
Click Comment link to get answer

Base SAS 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.
Click Comment link to get answer

Base SAS 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));
Click Comment link to get answer

Base SAS 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.
Click Comment link to get answer

Base SAS 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)
Click Comment link to get answer

Base SAS 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)
Click Comment link to get answer

Base SAS 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)
Click Comment link to get answer

Base SAS 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.
Click Comment link to get answer

Base SAS 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;
run;
Click Comment link to get answer

Base SAS 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)
Click Comment link to get answer

Base SAS 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)
Click Comment link to get answer

Base SAS 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;
run;
Which one of the following represents the values of the AMOUNT and WORD variables?
A. amount word
7 FOUR
B. amount word
7 SEVEN
C. amount word
4 FOUR
D. amount word
4 ' ' (missing character value)
Click Comment link to get answer

Base SAS 67

The SAS data set EMPLOYEE_INFO is listed below:
IDNumber Expenses
2542 100.00
3612 133.15
2198 234.34
2198 111.12
The following SAS program is submitted:
proc sort data = employee_info;

run;
Which one of the following BY statements completes the program and sorts the data sequentially by descending expense values within
each descending IDNUMBER value?
A. by descending IDNumber Expenses;
B. by (IDNumber Expenses) descending;
C. by IDNumber descending Expenses descending;
D. by descending IDNumber descending Expenses;
Click Comment link to get answer

Base SAS 68

The SAS data set QTR1_REVENUE is listed below:
destination revenue
YYZ 53634
FRA 62129
FRA 75962
RDU 76254
YYZ 82174
The following SAS program is submitted:
proc sort data = qtr1_revenue;
by destination descending revenue;
run;
Which one of the following represents the first observation in the output data set?
A. destination revenue
YYZ 82174
B. destination revenue
YYZ 53634
C. destination revenue
FRA 62129
D. destination revenue
FRA 75962
Click Comment link to get answer

Base SAS 69

The following SAS program is submitted:
libname company 'SAS-data-library';
proc sort data = company.payroll;
by EmployeeIDNumber;
run;
Write access has been granted to the COMPANY library.
Which one of the following represents how the observations are sorted?
A. COMPANY.PAYROLL is recreated in sorted order by EmployeeIDNumber.
B. COMPANY.PAYROLL is stored in original order, and a new data set PAYROLL is created in sorted order by
EmployeeIDNumber.
C. COMPANY.PAYROLL is stored in original order, and a new data set COMPANY.PAYROLLSORTED is created in sorted order
by EmployeeIDNumber.
D. COMPANY.PAYROLL is recreated in sorted order by EmployeeIDNumber, and a new data set PAYROLL is created in sorted
order by EmployeeIDNumber.
Click Comment link to get answer

Base SAS 70

The SAS data set EMPLOYEE_INFO is listed below:
IDNumber Expenses
2542 100.00
3612 133.15
2198 234.34
2198 111.12
The following SAS program is submitted:
proc sort data = employee_info;

run;
Which one of the following BY statements completes the program and sorts the data sequentially by ascending expense values within
each ascending IDNUMBER value?
A. by Expenses IDNumber;
B. by IDNumber Expenses;
C. by ascending (IDNumber Expenses);
D. by ascending IDNumber ascending Expenses;
Click Comment link to get answer