You are on page 1of 11

QUESTION 1

The following SAS program is submitted:


data one;
addressl = 214 London Way;
run;
data one;
set one;
address = tranwrd(address1, Way, Drive);
run;
What are the length and value of the variable ADDRESS?
Options:
A.

Length is 14; value is 214 London Dri.

B.

Length is 14; value is 214 London Way.

C.

Length is 16; value is 214 London Drive.

D.

Length is 200; value is 214 London Drive.

QUESTION 2
Given the SAS data set SASDATA.TWO:
SASDATA.TWO
XY
---52
31
56
The following SAS program is submitted:
data sasuser.one two sasdata.three;
set sasdata two;
if x = 5 then output sasuser.one;
else output sasdata two;
run;
What is the result?
Options:
A. data set SASUSER.ONE has 5 observations
data set SASUSER.TWO has 5 observations
data set WORK.OTHER has 3 observations
B. data set SASUSER.ONE has 2 observations

data set SASUSER.TWO has 2 observations


data set WORK.OTHER has 1 observations
C. data set SASUSER.ONE has 2 observations
data set SASUSER.TWO has 2 observations
data set WORK.OTHER has 5 observations
D. No data sets are output.
The DATA step fails execution due to syntax errors.

QUESTION 3
The following program is submitted.
data WORK.TEST;
input Name $ Age;
datalines;
John +35
;
run;
Which values are stored in the output data set?
Options:
A.

Name

Age

--------------------John

35
B.

Name

Age

--------------------John

(missing value)
C.

Name

Age

--------------------(missing value)

(missing value)

4.The DATA step fails execution due to data errors.

QUESTION 4
Given the SAS data set WORK.ONE:
Id Char1
--- ----182 M
190 N
250 O
720 P
and the SAS data set WORK.TWO:

Id Char2
--- ----182 Q
623 R
720 S
The following program is submitted:
data WORK.BOTH;
merge WORK.ONE WORK.TWO;
by Id;
run;
What is the first observation in the SAS data set WORK.BOTH?
Options:
1.Id Char1 Char2
--- ----- ----182 M

2.Id Char1 Char2


--- ----- ----182

3.Id Char1 Char2


--- ----- ----182 M

4.Id Char1 Char2


--- ----- ----720 P

QUESTION 5
Which program displays a listing of all data sets in the SASUSER library?
Options:
A.

proc contents lib = sasuser.all; run;

B.

proc contents data = sasuser.all; run;

C.

proc contents lib = sasuser._alI_; run;

D.

proc contents data = sasuser._all_; run;

QUESTION 6
The following SAS program is submitted:

proc format;
value score 1 - 50 = 'Fail'
51 - 100 = 'Pass';
run;
Which one of the following PRINT procedure steps correctly applies the format?
Options:
A.

proc print data = SASUSER.CLASS;


var test;
format test score;

run;
B.

proc print data = SASUSER.CLASS;


var test;
format test score.;
run;

C.

proc print data = SASUSER.CLASS format = score;


var test;

run;

D.

proc print data = SASUSER.CLASS format = score.;

var test;
run;

QUESTION 7
Given the text file COLORS.TXT:
----+----1----+----2----+---RED

ORANGE YELLOW GREEN

BLUE

INDIGO PURPLE VIOLET

CYAN

WHITE

GRAY

BROWN

FUCSIA BLACK
PINK

MAGENTA

The following SAS program is submitted:


data WORK.COLORS;
infile 'COLORS.TXT';
input @1 Var1 $ @8 Var2 $ @;
input @1 Var3 $ @8 Var4 $ @;

run;
What will the data set WORK.COLORS contain?
Options:
A.

Var1

------

Var2

------

Var3

Var4

------ ------

RED

ORANGE

RED

ORANGE

BLUE

INDIGO

BLUE

INDIGO

CYAN

WHITE

CYAN

WHITE

GRAY

BROWN

B.

Var1

------

GRAY

Var2

------

BROWN

Var3

Var4

------ ------

RED

ORANGE

BLUE

INDIGO

CYAN

WHITE

GRAY

BROWN

C.

Var1

------

Var2

------

Var3

Var4

------ ------

RED

ORANGE

YELLOW GREEN

BLUE

INDIGO

PURPLE VIOLET

D.

Var1

------

Var2

------

Var3

Var4

------ ------

RED

ORANGE

YELLOW GREEN

BLUE

INDIGO

PURPLE VIOLET

CYAN

WHITE

FUCSIA BLACK

GRAY

BROWN

PINK

MAGENTA

QUESTION 8
The following SAS program is submitted:
data work.accounting;
set work.dept1 work.dept2;
jobcode = FA1;
length jobcode $ 8;
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. What
is the length of the variable JOBCODE in the output data set?
Options:

A.

B.

C.

D.

QUESTION 9
Given the SAS data set WORK.INPUT:
Var1

Var2

------

-------

one

two

three

four

five

The following SAS program is submitted:


data WORK.ONE WORK.TWO;
set WORK.INPUT;
if Var1='A' then output WORK.ONE;
output;
run;
How many observations will be in data set WORK.ONE?
Options:
A.

B.

C.

D.

QUESTION 10
Given the following SAS error log
data WORK.OUTPUT;
set SASHELP.CLASS;
BMI=(Weight*703)/Height**2;
where bmi ge 20;
ERROR: Variable bmi is not on file SASHELP.CLASS.
run;
What change to the program will correct the error?
Options:

1.Replace the WHERE statement with an IF statement


2.Change the ** in the BMI formula to a single *
3.Change bmi to BMI in the WHERE statement
4.Add a (Keep=BMI) option to the SET statement

QUESTION 11
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 footnote(s) is/are displayed in the report?
Options:
A.

All Products

B.

Sales Report for Last Month All Products

C.

All Products All Regions All Figures in Thousands of Dollars

D.

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

QUESTION 12
The following SAS program is submitted:
data WORK.LOOP;
X = 0;
do Index = 1 to 5 by 2;
X = Index;
end;
run;
Upon completion of execution, what are the values of the variables X and Index in the SAS data set named
WORK.LOOP?
Options:
1.X
2.X
3.X
4.X

=
=
=
=

3,
5,
5,
5,

Index
Index
Index
Index

=
=
=
=

5
5
6
7

QUESTION 13
This item will ask you to provide a line of missing code;
The SAS data set WORK.INPUT contains 10 observations, and includes the numeric variable Cost.

The following SAS program is submitted to accumulate the total value of Cost for the 10 observations:
data WORK.TOTAL;
set WORK.INPUT;
<insert code here>
Total=Total+Cost;
run;
Which statement correctly completes the program?
Options:
1.keep Total;
2.retain Total 0;
3.Total = 0;
4.If _N_= 1 then Total = 0;

QUESTION 14
Given the raw data record DEPT:
----|----10---|----20---|----30
Printing 750
The following SAS program is submitted:
data bonus;
infile dept;
inputdept$ 1-11 number 13- 15;
<insert statement here>
run;
Which SAS statement completes the program and results in a value of Printing750 for the DEPARTMENT variable?
Options:
A.

department = dept II number;

B.

department = left(dept) II number;

C.

department = trim(dept) number;

D.

department=trim(dept)||put(number,3.);

QUESTION 15
This question will ask you to provide a line of missing code.
Given the following data set WORK.SALES:
SalesID SalesJan FebSales MarchAmt
------- -------- -------- -------W6790

50

400

350

W7693

25

100

125

W1387

300

250

The following SAS program is submitted:


data WORK.QTR1;
set WORK.SALES;
array month{3} SalesJan FebSales MarchAmt;
<insert code here>
run;
Which statement should be inserted to produce the following output?
SalesID SalesJan FebSales MarchAmt Qtr1
------- -------- -------- -------- ---W6790

50

400

350

800

W7693

25

100

125

250

W1387

300

250

550

Options:
A.

Qtr1 = sum(of month{_ALL_});

B.

Qtr1 = month{1} + month{2} + month{3};

C.

Qtr1 = sum(of month{*});

D.

Qtr1 = sum(of month{3});

QUESTION 16
The SAS data set SASUSER.HOUSES contains a variable PRICE which has been assigned a permanent label of Asking
Price. Which SAS program temporarily replaces the label Asking Price with the label Sale Price in the output?
Options:
A.

proc print data = sasuser.houses; label price = Sale Price; run;

B.

proc print data = sasuser.houses label; label price Sale Price; run;

C.

proc print data = sasuser.houses label; label price = Sale Price; run;

D.

proc print data = sasuser.houses; price = Sale Price; run;

QUESTION 17
The following SAS program is submitted:
data one;
addressl = 214 London Way;
run;
data one;
set one;
address = tranwrd(address1, Way, Drive);
run;

What are the length and value of the variable ADDRESS?

A.

Length is 14; value is 214 London Dri.

B.

Length is 14; value is 214 London Way.

C.

Length is 16; value is 214 London Drive.

D.

Length is 200; value is 214 London Drive.

QUESTION 18
The following SAS program is submitted:
data WORK.TEMP;
Char1='0123456789';
Char2=substr(Char1,3,4);
run;
What is the value of Char2?
Options:
A.

23

B.

34

C.

345

D.

2345

QUESTION 19
The SAS data sets WORK.EMPLOYEE and WORK.SALARY are shown below:
WORK.EMPLOYEE WORK.SALARY
fname age name salary
Bruce 30 Bruce 25000
Dan 40 Bruce 35000
Dan 25000
The following SAS program is submitted:
data work.empdata;
by fname;
totsal + salary;
run;
Which one of the following statements completes the merge of the two data sets by the FNAME variable?
Options:
A.

merge work.employee

work.salary (fname = name);


B.

merge work.employee

work.salary (name = fname);


C.

merge work.employee

work.salary (rename = (fname = name));


D.

merge work.employee

work.salary (rename = (name = fname));

QUESTION 20
The following SAS program is submitted:
data work.sets;
do until (prod gt 6);
prod + 1;
end;
run;
What is the value of the variable PROD in the output data set?
Options:
A.

B.

C.

D.

(missing numeric)

You might also like