Você está na página 1de 66

PROG2 ASSESSMENT

PROG2 Chapter 2: ................................................................................................................................2


Objective: (2.2.1) Explicitly control output of observations to SAS dataset.......................................................2
Objective: (2.2.2) Writing to Multiple SAS datasets...........................................................................................5
Objective: (2.2.3) Subsetting IF-statement..........................................................................................................6
Objective: (2.2.4) Controlling Variable output....................................................................................................7
Objective: (2.2.5) Controlling which Observations are Read............................................................................11
Objective: (2.2.6) Temporary Variables............................................................................................................13
Objective: (2.2.7) Writing to an External File...................................................................................................14
PROG2 Chapter 3: ..............................................................................................................................15
Objective: (2.3.1) Creating an Accumulating Variable.....................................................................................15
Objective: (2.3.2) Accumulating Totals for Group of Data...............................................................................23
Objective: (2.3.3) Subsetting IF-statements.......................................................................................................26
PROG2 Chapter 4................................................................................................................................27
Objective: (2.4.1) Reading raw data files..........................................................................................................27
Objective: (2.4.2) Reading hierarchical files.....................................................................................................38
PROG2 Chapter 5................................................................................................................................39
Objective: (2.5.1) Using SAS Functions............................................................................................................39
Objective: (2.5.2) MEAN Function...................................................................................................................40
Objective: (2.5.3) SCAN Function....................................................................................................................42
Objective: (2.5.4) INTNX Function...................................................................................................................44
Objective: (2.5.5) SUBSTR and Concatenation................................................................................................45
Objective: (2.5.6) SUBSTR...............................................................................................................................46
Objective: (2.5.7) Concatenation ......................................................................................................................49
Objective: (2.5.8) SCAN Function and Concatenation.....................................................................................50
Objective: (2.5.9) INDEX Function...................................................................................................................51
Objective: (2.5.10) TRANWRD Function.........................................................................................................52
Objective: (2.5.11) ROUND Function...............................................................................................................54
Objective: (2.5.12) CEIL Function....................................................................................................................56
Objective: (2.5.13) FLOOR Function................................................................................................................57
Objective: (2.5.14) INT Function......................................................................................................................58
Objective: (2.5.15) SUM Function....................................................................................................................60
Objective: (2.5.16) Date Functions....................................................................................................................62
PROG2 Chapter 7................................................................................................................................65
Objective: (2.7.1) DO Loop Processing.............................................................................................................65
Objective: (2.7.2) SUM Statement.....................................................................................................................66

PROG1 assessment questions

PROG2 assessment questions


PROG2 Chapter 2:
Objective: (2.2.1) Explicitly control output of observations to SAS dataset
Item: 2.2.1.a.1
The following data step executes:
data a b;
set c;
if Dept = 'Admin' then output a;
run;

Given the dataset work.c below, how many observations will the datasets a and b contain?

A.

a=3
b=8

B.

a=3
b=0

C.

a=3
b=5

D.

a=8
b=8

Page 2 of 66

PROG1 assessment questions

Item: 2.2.1.b.1
The following data step executes:
data a b;
set c;
if Dept = 'Admin' then output;
run;

Given the dataset work.c below, how many observations will the datasets a and b contain?

A.

a=3
b=8

B.

a=3
b=3

C.

a=3
b=5

D.

a=8
b=8

Page 3 of 66

PROG1 assessment questions

Item: 2.2.1.c.1
The following data step executes:
data a;
set b;
Total + 1;
output;
Total + 1;
output;
Total + 1;
output;
run;

How many observations will be written to dataset a with each iteration?


A.

B.

C.

D.

None of the above.

Page 4 of 66

PROG1 assessment questions

Objective: (2.2.2) Writing to Multiple SAS datasets


Item: 2.2.2.a.1
The following data step executes:
data a b;
set c;
if Dept = 'Admin' then output a
else output b;
run;

Given the dataset work.c below, how many observations will dataset a and b contain?

A.

a=3
b=5

B.

a=3
b=0

C.

a=3
b=8

D.

a=8
b=8

Page 5 of 66

PROG1 assessment questions

Objective: (2.2.3) Subsetting IF-statement


Item: 2.2.3.a.1
The following data step executes:
data a b;
set c;
if Dept = 'Admin';
run;

Given the dataset work.c below, how many observations will datasets a and b contain?

A.

a=3
b=3

B.

a=8
b=8

C.

a=3
b=5

D.

a=3
b=8

Page 6 of 66

PROG1 assessment questions

Objective: (2.2.4) Controlling Variable output


Item: 2.2.4.a.1
The following data step executes:
data b;
set a;
drop Salary;
Bonus = Salary * .10;
run;

Given the dataset work.a below, which of the following variables will appear in dataset b?

A.

EmpNo, Dept and Bonus

B.

EmpNo, Dept and Salary

C.

EmpNo, Salary and Bonus

D.

EmpNo, Dept, Salary and Bonus

Page 7 of 66

PROG1 assessment questions

Item: 2.2.4.b.1
The following data step executes:
data b;
set a;
drop Salary;
Bonus = Salary * .10;
run;

Given the dataset work.a below, which of the following variables will appear in the PDV (Program Data
Vector)?

A.

EmpNo, Dept and Bonus

B.

EmpNo, Dept and Salary

C.

EmpNo, Salary and Bonus

D.

EmpNo, Dept, Salary and Bonus

Page 8 of 66

PROG1 assessment questions

Item: 2.2.4.c.1
The following data step executes:
data b(keep = Salary Bonus);
set a(drop = EmpNo);
Bonus = Salary * .10;
run;

Given the dataset work.a below, which of the following variables will appear in the PDV (Program Data
Vector)?

A.

Dept and Salary

B.

Salary and Bonus

C.

Dept, Salary and Bonus

D.

EmpNo, Salary and Bonus

Page 9 of 66

PROG1 assessment questions

Item: 2.2.4.d.1
The following data step executes:
data b;
set a(keep = EmpNo Salary);
Bonus = Salary * .10;
run;

Given the dataset work.a below, which of the following variables will appear in the PDV (Program Data
Vector)?

A.

EmpNo and Salary

B.

EmpNo, Dept and Salary

C.

EmpNo, Salary and Bonus

D.

EmpNo, Dept, Salary and Bonus

Page 10 of 66

PROG1 assessment questions

Objective: (2.2.5) Controlling which Observations are Read


Item: 2.2.5.a.1
The following data step executes:
data a;
set b (obs = 25);
run;

Which of the following observations will be read?


A.

1 to 25

B.

25 till end

C.

observation 25 only

D.

25 randomly selected observations

Item: 2.2.5.b.1
The following data step executes:
data a;
set b (firstobs = 20 obs = 25);
run;

Which of the following observations will be read?


A.

20 to 25

B.

20 and 25

C.

20 and 25 till end

D.

25 observations, starting at observation 20

Page 11 of 66

PROG1 assessment questions

Item: 2.2.5.c.1
The following data step executes:
data a;
set b (firstobs = 25);
run;

Which of the following observations will be read?


A.

observation 25 only

B.

observations 1 to 25

C.

25 till end of dataset

D.

observation 25 first, then randomly selected observations

Page 12 of 66

PROG1 assessment questions

Objective: (2.2.6) Temporary Variables


Item: 2.2.6.a.1
Which of the following is represented by the automatic variable _N_ ?
A.

The number of active datasets.

B.

The number of observations in a dataset.

C.

The number of iterations of the DATA step during dataset processing.

D.

The observation number being processed during the DATA step processing.

Item: 2.2.6.b.1
Which of the following correctly describes the effect of using the END= option in the SET statement?
A.

The last observation is read from a dataset.

B.

The data step label is executed at the end of the data step.

C.

A variable is set to 1 until the last observation is read from a dataset.

D.

A variable is set to 1 when the last observation is read from a dataset.

Page 13 of 66

PROG1 assessment questions

Objective: (2.2.7) Writing to an External File


Item: 2.2.7.a.1
Which of the following programs correctly writes the observations from the dataset below to a raw data file?

A.

data _NULL_;
set work.patients;
file 'c:\clinic\patients\referals.dat';
put id 1-4 sex 6 age 8-9 height 11-12
weight 14-16 pulse 18-20;
run;

B.

data _NULL_;
set work.patients;
infile 'c:\clinic\patients\referals.dat';
input id 1-4 sex 6 age 8-9 height 11-12
weight 14-16 pulse 18-20;
run;

C.

data referals.dat;
set work.patients;
input id 1-4 sex 6 age 8-9 height 11-12
weight 14-16 pulse 18-20;
run;

D.

data _NULL_;
set work.patients;
file c:\clinic\patients\referals.dat;
put id 1-4 sex 6 age 8-9 height 11-12
weight 14-16 pulse 18-20;
run;

Page 14 of 66

PROG1 assessment questions

PROG2 Chapter 3:
Objective: (2.3.1) Creating an Accumulating Variable
Item: 2.3.1.a.1
The following data step executes:
data new;
set old;
retain Total 0;
Total = Total + Sales;
run;

Given the input file below, what will be the result?

A.

B.

C.

Page 15 of 66

PROG1 assessment questions

D.

Item: 2.3.1.b.1
The following data step executes:
data new;
set old;
Total = Total + Sales;
run;

Given the input file below, what will be the result?

A.

B.

Page 16 of 66

PROG1 assessment questions

C.

D.

Item: 2.3.1.c.1
The following data step executes:
data new;
set old;
Total + Sales;
run;

Given the input file below, what will be the result?

A.

Page 17 of 66

PROG1 assessment questions

B.

C.

D.

Item: 2.3.1.d.1
The following data step executes:
data new;
set old;
retain Total 1000;
Total + Sales;
run;

Given the input file below, what will be the result?

Page 18 of 66

PROG1 assessment questions

A.

B.

C.

D.

Item: 2.3.1.e.1
The following data step executes:
data new;
set old;
retain Total 0;
Total = sum(Total,Sales);
run;

Given the input file below, what will be the result?

Page 19 of 66

PROG1 assessment questions

A.

B.

C.

D.

Page 20 of 66

PROG1 assessment questions

Item: 2.3.1.f.1
The following data step executes:
data new;
set old;
retain Total 1000;
Total = sum(Total,Sales);
run;

Given the input file below, what will be the result?

A.

B.

C.

D.

Page 21 of 66

PROG1 assessment questions

Page 22 of 66

PROG1 assessment questions

Objective: (2.3.2) Accumulating Totals for Group of Data


Item: 2.3.2.a.1
Which of the following is indicated when LAST.variable is true?
A.

The last element of an array.

B.

The last iteration of a DO loop.

C.

The current observation is the last one in the dataset.

D.

The current observation is the last one of BY group x.

Item: 2.3.2.b.1
The following data step executes:
data summary;
set employees;
drop EmpNo;
by Dept;
if first.dept = 1 then total = 0;
Total + Salary;
if last.dept;
run;

Given the input file below, what will be the result?

A.

Page 23 of 66

PROG1 assessment questions

B.

C.

D.

Item: 2.3.2.c.1
The variable EmpNo must have unique values.
Which of the following statements is correct?
A.

FIRST.EmpNo = 0
LAST.EmpNo = 0

B.

FIRST.EmpNo = 0
LAST.EmpNo = 1

C.

FIRST.EmpNo = 1
LAST.EmpNo = 0

D.

FIRST.EmpNo = 1
LAST.EmpNo = 1

Page 24 of 66

PROG1 assessment questions

Item: 2.3.2.d.1
Which of the following statements is FALSE?
When using the BY statement with the SET statement...
A.

FIRST. and LAST. are stored in the dataset.

B.

FIRST. and LAST. identify the first and last observation in each BY group respectively.

C.

the dataset listed in the SET statement must be indexed or sorted by the values of the BY variable.

D.

the DATA step automatically creates two variables - FIRST. and LAST. - for each variable in the BY
statement.

Page 25 of 66

PROG1 assessment questions

Objective: (2.3.3) Subsetting IF-statements


Item: 2.3.3.a.1
Which of the following statements is true?
The subsetting IF statement...
A.

is not executable.

B.

is often more efficient than a WHERE statement.

C.

does not perform automatic numeric-to-character conversion.

D.

can select observations from raw data read with the INPUT statement.

Page 26 of 66

PROG1 assessment questions

PROG2 Chapter 4
Objective: (2.4.1) Reading raw data files
Item: 2.4.1.a.1
Which of the following statements is true?
The @ symbol...
A.

invokes a macro.

B.

represents a macro variable.

C.

moves an input pointer to a specific location on an input record.

D.

advances an input pointer a specific number of positions on an input record.

Item: 2.4.1.b.1
How many records will be read during each iteration of the following DATA step?
data sasdata;
infile textfile;
retain idnum;
input rectype $1. @;
if rectype = 'h' then input idnum $4.;
else input dept $4.
date date7.
jobcode $3.;
if rectype ne 'h';
run;

A.

B.

C.

D.

Page 27 of 66

PROG1 assessment questions

Item: 2.4.1.c.1
A SAS program is to be prevented from going to a new input line if it does not find values in the current line for
all the INPUT statement variables.
Which of the following INFILE statements option should be used?
A.

DSD

B.

LRECL=

C.

LINESIZE=

D.

MISSOVER

Item: 2.4.1.d.1
The following program executes:
data sales;
infile rawdata;
input date date7. Dailysum @@;
run;

Given the raw data file below, how many observations will be created?

A.

B.

10

C.

15

D.

20

Page 28 of 66

PROG1 assessment questions

Item: 2.4.1.e.1
The following program executes:
data one;
infile rawdata;
input @3 year 4.;
if year = 1997 then input @8 amount 3.;
run;

Given the raw data file below, how many observations will be created?

A.

B.

C.

D.

Item: 2.4.1.f.1
Which of the following types of input will be used to read character and numeric data that are NOT stored in
fixed locations?
A.

LIST input

B.

COLUMN input

C.

FORMATTED input

D.

None of the above.

Page 29 of 66

PROG1 assessment questions

Item: 2.4.1.g.1
Which of the following types of input can be used to read standard character and numeric data that are stored
in fixed locations?
A.

COLUMN input only

B.

FORMATTED input only

C.

COLUMN and LIST input

D.

COLUMN and FORMATTED input

Item: 2.4.1.h.1
Which of the following types of input can be used to read non-standard character and numeric data that are
stored in fixed locations?
A.

LIST input

B.

NAMED input

C.

COLUMN input

D.

FORMATTED input

Item: 2.4.1.i.1
Which of the following SAS statements associates the fileref crime with the raw data file C:\My
Documents\Crime?
A.

filename crime C:\My Documents\crime;

B.

fileref crime 'C:\My Documents\crime';

C.

filename crime 'C:\My Documents\crime';

D.

filename 'C:\My Documents\crime' crime;

Page 30 of 66

PROG1 assessment questions

Item: 2.4.1.j.1
Which of the following statements correctly reads the fields in this order: StockNo, Price, Item, Finish, Style?

A.

input StockNo $ 1-3 Price 27-32 Item $ 20-24 Finish $ 5-9 Style $ 11-18;

B.

input $ StockNo 1-3 Price 27-32 $ Item 20-24 $ Finish 5-9 $ Style 11-18;

C.

input StockNo $ 1-3 Finish $ 5-9 Style $ 11-18 Item $ 20-24 Price 27-32;

D.

input StockNo $ 1-3 Price $ 27-32 Item $ 20-24 Finish $ 5-9 Style $ 11-18;

Item: 2.4.1.k.1
Which of the following will be regarded as non-standard data?
A.

17.6

B.

-25.3

C.

2,371.61

D.

1.54E+03

Page 31 of 66

PROG1 assessment questions

Item: 2.4.1.l.1
What is an informat?
An instruction that specifies to SAS...
A.

to create a variable.

B.

how to read raw data.

C.

how to display data values.

D.

how to display variable labels.

Item: 2.4.1.m.1
What is the default length of character variables that are created when using LIST input?
A.

B.

255

C.

200

D.

The length of the variable being read.

Page 32 of 66

PROG1 assessment questions

Item: 2.4.1.o.1
The following program executes:
data one;
infile 'C:\numbers.dat';
input X @@;
if X=1 then X=5;
if X=2 then X=4;
if X=4 then X=3;
if X=5 then X=1;
run;

Given the raw data file below, what will the contents of the SAS dataset one be?

A.

B.

C.

Page 33 of 66

PROG1 assessment questions

D.

Item: 2.4.1.p.1
The following program executes:
data staff;
infile rawdata;
input name $9. @10 dept $5. @15 salary 6. @21
office $3. @24 country $2.;
run;

Given the table below, what value will be assigned to the variable salary?

A.

17

B.

17250

C.

17.250

D.

. (missing)

Page 34 of 66

PROG1 assessment questions

Item: 2.4.1.q.1
In which of the following statements can the DLM= option be used?
A.

SET statement

B.

DATA statement

C.

INPUT statement

D.

INFILE statement

Item: 2.4.1.r.1
What will the default delimeter be set to when the DSD option is used?
A.

blank

B.

: (colon)

C.

, (comma)

D.

tab character

Item: 2.4.1.s.1
Which of the following SAS statements correctly reads the values for Fname, Lname, Address, City, State and
Zip in that order?

A.

Input / Fname $ Lname $;


/ Address $20.;
City $ State $ Zip $;

B.

Input Fname $ Lname $ /


Address $20. /
Page 35 of 66

PROG1 assessment questions

City $ State $ Zip $;


C.

Input / Fname $ Lname $


/ Address $20.
City $ State $ Zip $;

D.

Input Fname $ Lname $ /;


Address $20. /;
City $ State $ Zip $;

Item: 2.4.1.t.1
Which of the following statements about the double trailing at sign (@@) is NOT TRUE?
A.

It must be the last item specified in the INPUT statement.

B.

It is released when the input pointer moves past the end of the record.

C.

It enables the next INPUT statement to read from the current record in the same iteration of the
DATA step.

D.

It enables the next INPUT statement to read from the current record across multiple iterations of the
DATA step.

Item: 2.4.1.u.1
Which of the following statements is true?
A record that is being held by a single trailing at sign (@) will be automatically released when...
A.

the next iteration of the DATA step begins.

B.

another value is read from the observation.

C.

the input pointer moves past the end of the record.

D.

another INPUT statement that has an @ executes.

Page 36 of 66

PROG1 assessment questions

Item: 2.4.1.v.1
Which of the following is an example of standard numeric data?
A.

1/2

B.

50%

C.

-34.256

D.

$24,234.25

Item: 2.4.1.w.1
Which informat should be used to read the values in column 1 - 5?

A.

w.

B.

$w.

C.

w.d

D.

commaw.d

Item: 2.4.1.x.1
Which of the following statements correctly identifies the name of a raw data file which is to be read with a
fileref products and specifies that the data step only reads records 1 - 15?
A.

input products 1 - 15;

B.

infile products obs 15;

C.

input products obs = 15;

D.

infile products obs = 15;

Page 37 of 66

PROG1 assessment questions

Objective: (2.4.2) Reading hierarchical files


Item: 2.4.2.a.1
Which of the following statements are true when reading hierarchical files?
To write a data step to create one observation per detail record it is necessary to
I.
distinguish between header and detail records.
II. hold the current value of each record type so that the other values in the record can be read.
III. retain the header record as part of each observation until the next header record is encountered.
A.

I. and II. only

B.

I. and III. only

C.

II. and III. only

D.

I., II. and III.

Page 38 of 66

PROG1 assessment questions

PROG2 Chapter 5
Objective: (2.5.1) Using SAS Functions
Item: 2.5.1.a.1
Which of the following characters is used to separate arguments within a SAS function?
A.

blank

B.

: (colon)

C.

, (comma)

D.

; (semi colon)

Page 39 of 66

PROG1 assessment questions

Objective: (2.5.2) MEAN Function


Item: 2.5.2.a.1
The following program executes:
data averages;
set quarters;
average = mean(qtr1,qtr2,qtr3,qtr4);
run;

Given the observation shown in the table below, what will the value of average be?

A.

B.

C.

D.

. (missing)

Item: 2.5.2.b.1
How can the list of arguments in the MEAN function of the program below be abbreviated?
data averages;
set quarters;
average = mean(qtr1,qtr2,qtr3,qtr4);
run;
A.

mean (qtr1 - 4)

B.

mean (qtr1 - qtr4)

C.

mean (of qtr1 - 4)

D.

mean (of qtr1 - qtr4)

Page 40 of 66

PROG1 assessment questions

Item: 2.5.2.c.1
The following program executes:
data averages;
set quarters;
average = mean(of qtr1-qtr4);
run;

Given the observation shown in the table below, what will the value of average be?

A.

B.

C.

D.

. (missing)

Item: 2.5.2.d.1
Which of the following functions calculates the average of the variables Qtr1, Qtr2, Qtr3 and Qtr4?
A.

AVG (of Qtr1,Qtr4)

B.

MEAN (of Qtr1,Qtr4)

C.

AVG (of Qtr1 - Qtr4)

D.

MEAN (of Qtr1 - Qtr4)

Page 41 of 66

PROG1 assessment questions

Objective: (2.5.3) SCAN Function


Item: 2.5.3.a.1
The relative order of words is known, but not their starting positions.
Which of the following functions can be used to extract words from a character value?
A.

TRIM

B.

SCAN

C.

INDEX

D.

SUBSTR

Item: 2.5.3.b.1
A new variable which was not previously defined with a LENGTH statement is created with the SCAN function.
What will the length of the new variable be?
A.

B.

12

C.

200

D.

The length of the variable used in the function.

Page 42 of 66

PROG1 assessment questions

Item: 2.5.3.c.1
The following data step executes:
data strings;
Text1 = "MICKEY MOUSE";
Text = scan(Text1,2);
run;

What will the length of the variable Text be?


A.

B.

11

C.

12

D.

200

Item: 2.5.3.d.1
The following data step executes:
data strings;
Text1 = "MICKEY MOUSE & DONALD DUCK";
Text = scan(text1,2,'&');
run;

What will the value of the variable Text be?


(Leading blanks are displayed using an asterisk *)
A.

MOUSE

B.

DONALD

C.

DONALD DUCK

D.

*DONALD DUCK

Page 43 of 66

PROG1 assessment questions

Objective: (2.5.4) INTNX Function


Item: 2.5.4.a.1
The result of
(...)
INTNX('YEAR','29FEB1980'D,1)
(...)

is a new date.
What will the new date be if the DATE9. format is used?
A.

01JAN1981

B.

28FEB1981

C.

29FEB1981

D.

01MAR1981

Page 44 of 66

PROG1 assessment questions

Objective: (2.5.5) SUBSTR and Concatenation


Item: 2.5.5.a.1
The following program executes:
data strings;
length text $ 30 text2 $ 30;
Text = "FRIENDS, LEND ME YOUR EARS!";
Text1 = SUBSTR(Text,9,5);
Text2 = Text1 || " MONEY";
run;

What will the value of the variable Text2 be, after completion of the data step?

Leading blanks are displayed using an asterisk (*)


A.

LEND

B.

*LEND

C.

LEND MONEY

D.

*LEND MONEY

Page 45 of 66

PROG1 assessment questions

Objective: (2.5.6) SUBSTR


Item: 2.5.6.a.1
A new variable which was not previously defined with a LENGTH statement is created with the SUBSTR
function.
What will the length of the new variable be?
A.

B.

12

C.

200

D.

The length of the variable used in the function.

Item: 2.5.6.b.1
The following data step executes:
data strings;
Text1 = "MICKEY MOUSE";
Text = substr(Text1,7);
run;

What will the value of the variable Text be?


Leading blanks are displayed using an asterisk (*)
A.

B.

*M

C.

MOUSE

D.

*MOUSE

Page 46 of 66

PROG1 assessment questions

Item: 2.5.6.c.1
The following data step executes:
data strings;
Text1 = "MICKEY MOUSE & DONALD DUCK";
Text = substr(Text1,16,6);
run;

What will the value of the variable Text be?


Leading blanks are displayed using an asterisk (*)
A.

DONALD

B.

*DONALD

C.

DONALD DUCK

D.

*DONALD DUCK

Item: 2.5.6.d.1
The following data step executes:
data strings;
Text1 = "MICKEY MOUSE & DONALD DUCK";
Text = substr(Text1,8,9);
run;

What will the value of the variable Text be?


A.

MO

B.

MOUSE

C.

OUSE & D

D.

MOUSE & D

Page 47 of 66

PROG1 assessment questions

Item: 2.5.6.e.1
The following data step executes:
data strings;
Text1 = "MICKEY MOUSE";
Text = substr(Text1,2);
run;

What will the value of the variable Text be?


A.

MOUSE

B.

MICKEY

C.

ICKEY MOUSE

D.

MICKEY MOUSE

Page 48 of 66

PROG1 assessment questions

Objective: (2.5.7) Concatenation


Item: 2.5.7.a.1
The following data step executes:
data strings;
Text = "MY" || "DOG";
run;

What will the length of the variable Text be?


A.

B.

C.

D.

200

Item: 2.5.7.b.1
The following data step executes:
data strings;
length Text1 $3;
Text1 = "MY";
Text = Text1 || "DOG";
run;

What will the length of the variable Text be?


A.

B.

C.

D.

200

Page 49 of 66

PROG1 assessment questions

Objective: (2.5.8) SCAN Function and Concatenation


Item: 2.5.8.a.1
The following data step executes:
data strings;
Text1 = "MICKEY MOUSE";
Text = "MINI" || scan(Text1,2);
run;

What will the length of the variable Text be?


A.

B.

15

C.

200

D.

204

Item: 2.5.8.b.1
The following data step executes:
data strings;
length Text2 $ 10;
Text1 = "MICKEY MOUSE";
Text2 = scan(Text1,2);
Text = "MINI" || " " || Text2;
run;

What will the length of the variable Text be?


A.

10

B.

15

C.

16

D.

205

Page 50 of 66

PROG1 assessment questions

Objective: (2.5.9) INDEX Function


Item: 2.5.9.a.1
The following data step executes:
data strings;
Text1 = "MICKEY MOUSE";
var1 = index(Text1,'MOUSE');
run;

What will the value of the variable Var1 be?


A.

B.

C.

D.

. (missing)

Item: 2.5.9.b.1
The following data step executes:
data strings;
Text1 = "MICKEY MOUSE";
var1 = index(Text1,'MINI');
run;

What will the value of the variable Var1 be?


A.

B.

C.

D.

. (missing)

Page 51 of 66

PROG1 assessment questions

Objective: (2.5.10) TRANWRD Function


Item: 2.5.10.a.1
The following data step executes:
data strings;
Text1 = "MICKEY MOUSE";
Text = tranwrd(Text1,'MICKEY','MINI');
run;

What will the value of the variable Text be?


A.

MINI

B.

MINI MOUSE

C.

MICKEY MOUSE

D.

MICKEY MINI MOUSE

Item: 2.5.10.b.1
The following data step executes:
data strings;
Text = "MICKEY MOUSE";
Text = tranwrd(Text,'MICKEY','MINI');
run;

What will the length of the variable Text be?


A.

B.

10

C.

12

D.

200

Page 52 of 66

PROG1 assessment questions

Item: 2.5.10.c.1
The following data step executes:
data strings;
Text1 = "MICKEY MOUSE";
Text = tranwrd(Text1,'MICKEY','MINI');
run;

What will the length of the variable Text be?


A.

B.

10

C.

12

D.

200

Page 53 of 66

PROG1 assessment questions

Objective: (2.5.11) ROUND Function


Item: 2.5.11.a.1
The following statement executes:
Var1 = round(23.128);

What will the value of the variable Var1 be?


A.

23

B.

23.1

C.

23.13

D.

. (missing)

Item: 2.5.11.b.1
The following statement executes:
Var1 = round(23.64,.1);

What will the value of the variable Var1 be?


A.

23.6

B.

23.7

C.

23.75

D.

24

Page 54 of 66

PROG1 assessment questions

Item: 2.5.11.c.1
The following statement executes:
Var1 = round(23.478,.01);

What will the value of the variable Var1 be?


A.

23.48

B.

23.480

C.

23.5

D.

24

Item: 2.5.11.d.1
The following statement executes:
Var1 = round(23.47,10);

What will the value of the variable Var1 be?


A.

20

B.

23

C.

23.5

D.

24

Page 55 of 66

PROG1 assessment questions

Objective: (2.5.12) CEIL Function


Item: 2.5.12.a.1
The following statement executes:
Var1 = ceil(-6.478);

What will the value of the variable Var1 be?


A.

-6

B.

-6.5

C.

-7

D.

-7.5

Item: 2.5.12.b.1
The following statement executes:
Var1 = ceil(6.478);

What will the value of the variable Var1 be?


A.

B.

6.5

C.

D.

7.5

Page 56 of 66

PROG1 assessment questions

Objective: (2.5.13) FLOOR Function


Item: 2.5.13.a.1
The following statement executes:
Var1 = floor(-6.478);

What will the value of the variable Var1 be?


A.

-6

B.

-6.5

C.

-7

D.

-7.5

Item: 2.5.13.b.1
The following statement executes:
Var1 = floor(6.478);

What will the value of the variable Var1 be?


A.

B.

6.4

C.

D.

7.4

Page 57 of 66

PROG1 assessment questions

Objective: (2.5.14) INT Function


Item: 2.5.14.a.1
The following statement executes:
Var1 = int(23.128);

What will the value of the variable Var1 be?


A.

23

B.

23.1

C.

23.128

D.

23.13

Item: 2.5.14.b.1
The following statement executes:
Var1 = int(23.84);

What will the value of the variable Var1 be?


A.

23

B.

23.84

C.

23.9

D.

24

Page 58 of 66

PROG1 assessment questions

Item: 2.5.14.c.1
The following statement executes:
Var1 = int(-23.84);

What will the value of the variable Var1 be?


A.

-23

B.

-23.84

C.

-23.9

D.

-24

Page 59 of 66

PROG1 assessment questions

Objective: (2.5.15) SUM Function


Item: 2.5.15.a.1
The following program executes:
data averages;
set quarters;
total = sum(qtr1,qtr2,qtr3,qtr4);
run;

Given the observation shown in the table below, what will the value of total be?

A.

B.

C.

12

D.

. (missing)

Item: 2.5.15.b.1
How can the list of arguments in the SUM function below be abbreviated?
data averages;
set quarters;
total = sum(qtr1,qtr2,qtr3,qtr4);
run;
A.

sum (qtr1 - 4)

B.

sum (of qtr1 - 4)

C.

sum (qtr1 - qtr4)

D.

sum (of qtr1 - qtr4)

Page 60 of 66

PROG1 assessment questions

Item: 2.5.15.c.1
Which of the following functions calculates the total of variables Qtr1, Qtr2, Qtr3 and Qtr4?
A.

sum (of Qtr1,Qtr4)

B.

tot (of Qtr1,Qtr4)

C.

sum (of Qtr1 - Qtr4)

D.

tot (of Qtr1 - Qtr4)

Page 61 of 66

PROG1 assessment questions

Objective: (2.5.16) Date Functions


Item: 2.5.16.a.1
Which of the following statements will correctly create a SAS date value for the 21 Oct 2002?
A.

dt1 = mdy(10,21,2002);

B.

dt1 = dmy(21,10,2002);

C.

dt1 = date(10,21,2002);

D.

dt1 = mmmddyy(10,21,2002);

Item: 2.5.16.b.1
Which of the following statements will correctly create a SAS date value for the 21 Oct 2002?
A.

dt1 = mdy(10,21,2002);

B.

dt1 = dmy(21 10 2002);

C.

dt1 = date(10:21:2002);

D.

dt1 = mmmddyy(10 21 02);

Item: 2.5.16.c.1
The following statement executes:
Dayval = DAY(TODAY( ));

What will the value of Dayval be for Monday, 21 Oct 2002 as today's date?
A.

B.

21

C.

. (missing)

D.

15634 (Number of days since 1 Jan 1960)

Page 62 of 66

PROG1 assessment questions

Item: 2.5.16.d.1
The following statement executes:
Dayval = WEEKDAY(TODAY( ));

What will the value of Dayval be for Monday, 21 Oct 2002 as today's date?
A.

B.

C.

21

D.

15634 (Number of days since 1 Jan 1960)

Item: 2.5.16.e.1
The following statement executes:
Yrval = YEAR(TODAY( ));

What will the value of Yrval be for Monday, 21 Oct 2002 as today's date?
A.

B.

02

C.

2002

D.

. (missing)

Page 63 of 66

PROG1 assessment questions

Item: 2.5.16.f.1
The following statement executes:
Mnthval = MONTH(TODAY( ));

What will the value of Mnthval be for Monday, 21 Oct 2002 as today's date?
A.

10

B.

Oct

C.

October

D.

. (missing)

Item: 2.5.16.g.1
The following statement executes:
Qtrval = QTR(TODAY( ));

What will the value of Qtrval be for Monday, 21 Oct 2002 as today's date?
A.

B.

C.

D.

Page 64 of 66

PROG1 assessment questions

PROG2 Chapter 7
Objective: (2.7.1) DO Loop Processing
Item: 2.7.1.a.1
The value of an index variable named count ranges from 1 - 20.
Which of the following SAS statements repetitively executes several statements, incremented by 5?
A.

do count = 1 to 20 + 5;

B.

do count = 1 to 20 by 5;

C.

do while count = 1 - 20 by 5;

D.

do while (count = 1 - 20 + 5);

Item: 2.7.1.b.1
Which of the following SAS statements repetitively executes several statements while the value of age is less
than 50?
A.

do age < 50;

B.

do age LT 50;

C.

do while age < 50;

D.

do while (age < 50);

Page 65 of 66

PROG1 assessment questions

Objective: (2.7.2) SUM Statement


Item: 2.7.2.a.1
Which of the following statements is a correct example of a SUM statement?
A.

Total+1;

B.

'Total' + 1;

C.

Total = Total +1;

D.

Total = SUM(total,1);

Page 66 of 66

Você também pode gostar