Escolar Documentos
Profissional Documentos
Cultura Documentos
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
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
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;
B.
C.
D.
Page 4 of 66
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
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
Given the dataset work.a below, which of the following variables will appear in dataset b?
A.
B.
C.
D.
Page 7 of 66
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.
B.
C.
D.
Page 8 of 66
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.
B.
C.
D.
Page 9 of 66
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.
B.
C.
D.
Page 10 of 66
1 to 25
B.
25 till end
C.
observation 25 only
D.
Item: 2.2.5.b.1
The following data step executes:
data a;
set b (firstobs = 20 obs = 25);
run;
20 to 25
B.
20 and 25
C.
D.
Page 11 of 66
Item: 2.2.5.c.1
The following data step executes:
data a;
set b (firstobs = 25);
run;
observation 25 only
B.
observations 1 to 25
C.
D.
Page 12 of 66
B.
C.
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.
B.
The data step label is executed at the end of the data step.
C.
D.
Page 13 of 66
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
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;
A.
B.
C.
Page 15 of 66
D.
Item: 2.3.1.b.1
The following data step executes:
data new;
set old;
Total = Total + Sales;
run;
A.
B.
Page 16 of 66
C.
D.
Item: 2.3.1.c.1
The following data step executes:
data new;
set old;
Total + Sales;
run;
A.
Page 17 of 66
B.
C.
D.
Item: 2.3.1.d.1
The following data step executes:
data new;
set old;
retain Total 1000;
Total + Sales;
run;
Page 18 of 66
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;
Page 19 of 66
A.
B.
C.
D.
Page 20 of 66
Item: 2.3.1.f.1
The following data step executes:
data new;
set old;
retain Total 1000;
Total = sum(Total,Sales);
run;
A.
B.
C.
D.
Page 21 of 66
Page 22 of 66
B.
C.
D.
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;
A.
Page 23 of 66
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
Item: 2.3.2.d.1
Which of the following statements is FALSE?
When using the BY statement with the SET statement...
A.
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
is not executable.
B.
C.
D.
can select observations from raw data read with the INPUT statement.
Page 26 of 66
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.
C.
D.
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
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
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.
Page 29 of 66
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.
B.
C.
D.
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.
B.
C.
D.
Page 30 of 66
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
Item: 2.4.1.l.1
What is an informat?
An instruction that specifies to SAS...
A.
to create a variable.
B.
C.
D.
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.
Page 32 of 66
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
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
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.
B.
D.
Item: 2.4.1.t.1
Which of the following statements about the double trailing at sign (@@) is NOT TRUE?
A.
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.
B.
C.
D.
Page 36 of 66
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.
B.
C.
D.
Page 37 of 66
B.
C.
D.
Page 38 of 66
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
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.
C.
D.
Page 40 of 66
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.
B.
C.
D.
Page 41 of 66
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.
Page 42 of 66
Item: 2.5.3.c.1
The following data step executes:
data strings;
Text1 = "MICKEY MOUSE";
Text = scan(Text1,2);
run;
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;
MOUSE
B.
DONALD
C.
DONALD DUCK
D.
*DONALD DUCK
Page 43 of 66
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
What will the value of the variable Text2 be, after completion of the data step?
LEND
B.
*LEND
C.
LEND MONEY
D.
*LEND MONEY
Page 45 of 66
B.
12
C.
200
D.
Item: 2.5.6.b.1
The following data step executes:
data strings;
Text1 = "MICKEY MOUSE";
Text = substr(Text1,7);
run;
B.
*M
C.
MOUSE
D.
*MOUSE
Page 46 of 66
Item: 2.5.6.c.1
The following data step executes:
data strings;
Text1 = "MICKEY MOUSE & DONALD DUCK";
Text = substr(Text1,16,6);
run;
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;
MO
B.
MOUSE
C.
OUSE & D
D.
MOUSE & D
Page 47 of 66
Item: 2.5.6.e.1
The following data step executes:
data strings;
Text1 = "MICKEY MOUSE";
Text = substr(Text1,2);
run;
MOUSE
B.
MICKEY
C.
ICKEY MOUSE
D.
MICKEY MOUSE
Page 48 of 66
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;
B.
C.
D.
200
Page 49 of 66
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;
10
B.
15
C.
16
D.
205
Page 50 of 66
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;
B.
C.
D.
. (missing)
Page 51 of 66
MINI
B.
MINI MOUSE
C.
MICKEY MOUSE
D.
Item: 2.5.10.b.1
The following data step executes:
data strings;
Text = "MICKEY MOUSE";
Text = tranwrd(Text,'MICKEY','MINI');
run;
B.
10
C.
12
D.
200
Page 52 of 66
Item: 2.5.10.c.1
The following data step executes:
data strings;
Text1 = "MICKEY MOUSE";
Text = tranwrd(Text1,'MICKEY','MINI');
run;
B.
10
C.
12
D.
200
Page 53 of 66
23
B.
23.1
C.
23.13
D.
. (missing)
Item: 2.5.11.b.1
The following statement executes:
Var1 = round(23.64,.1);
23.6
B.
23.7
C.
23.75
D.
24
Page 54 of 66
Item: 2.5.11.c.1
The following statement executes:
Var1 = round(23.478,.01);
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);
20
B.
23
C.
23.5
D.
24
Page 55 of 66
-6
B.
-6.5
C.
-7
D.
-7.5
Item: 2.5.12.b.1
The following statement executes:
Var1 = ceil(6.478);
B.
6.5
C.
D.
7.5
Page 56 of 66
-6
B.
-6.5
C.
-7
D.
-7.5
Item: 2.5.13.b.1
The following statement executes:
Var1 = floor(6.478);
B.
6.4
C.
D.
7.4
Page 57 of 66
23
B.
23.1
C.
23.128
D.
23.13
Item: 2.5.14.b.1
The following statement executes:
Var1 = int(23.84);
23
B.
23.84
C.
23.9
D.
24
Page 58 of 66
Item: 2.5.14.c.1
The following statement executes:
Var1 = int(-23.84);
-23
B.
-23.84
C.
-23.9
D.
-24
Page 59 of 66
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.
C.
D.
Page 60 of 66
Item: 2.5.15.c.1
Which of the following functions calculates the total of variables Qtr1, Qtr2, Qtr3 and Qtr4?
A.
B.
C.
D.
Page 61 of 66
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.
C.
dt1 = date(10:21:2002);
D.
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.
Page 62 of 66
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.
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
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
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.
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.
B.
do age LT 50;
C.
D.
Page 65 of 66
Total+1;
B.
'Total' + 1;
C.
D.
Total = SUM(total,1);
Page 66 of 66