Beruflich Dokumente
Kultur Dokumente
You answered 0 out of 50 questions correctly. To see any answer, scroll down
or click a question in the grid below. When you select links on this page, the
information appears in the original browser window.
1 2 3 4 5 6 7 8 9 10
Question #
Correct /
Incorrect
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50
1---+----10---+----20---+---
01/05/1989 Frank 11
12/25/1987 June 13
01/05/1991 Sally 9
The following SAS program is submitted using this file as input:
data work.family;
infile 'file-specification';
input @1 date_of_birth mmddyy10.
@15 first_name $5.
@25 age 3;
run;
11327 Sally .
Which of the following statements is true regarding the Work.Family
output?
The output for Work.Family does not have the expected data values. The
values for the variable Age are missing because the program contains an
invalid informat for Age. The informat for reading standard numeric data
is w.d, so the correct informat for Age is 3.. The informat for
Date_of_birth, mmddyy10., is correct.
a. 0
b. 1
c. 2
d. 3
Correct answer: c
Your answer:
1---+----10---+----20---+---
Jose,47,210
Sue,,108
The following SAS program is submitted using this file as input:
data employeestats;
<insert INFILE statement here>;
input name $ age weight;
run;
The following output is desired:
The correct INFILE statement uses the DSD option to read the data with
commas as delimiters and uses two consecutive commas to indicate a
missing value. The PAD option specifies that SAS pad variable length
records with blanks. The MISSOVER option prevents SAS from reading
past the end of the line when reading free-formatted data. The DLM=
option specifies the comma as the delimiter, but by default consecutive
delimiters are treated as one delimiter rather than as an indication of a
missing value.
1---+----10---+----20---+---
RANCH,1250,10MAR2004
SPLIT,1190,10/20/2004
CONDO,1400,17JUN2004
TWOSTORY,1810,12/31/2004
RANCH,1500,20JAN2004
SPLIT,1615,08/19/2004
a. 0
b. 3
c. 5
d. 6
Correct answer: d
Your answer:
1---+----10---+----20---+----30---+----40---+----50
TWOSTORY 1040 2 1SANDERS ROAD $55,850
CONDO 2150 4 2.5JEANS AVENUE $127,150
The following program is submitted using this file as input:
data work.houses;
infile 'file-specification';
<insert INPUT statement here>
run;
Which one of the following INPUT statements reads the raw data file
correctly?
a. 0
b. 9
c. 10
d. 19
Correct answer: d
Your answer:
Sasdata.Two
x y
5 2
5 4
3 6
a. The data set Sasuser.One has 0 observations and the data set One
has 0 observations.
b. The data set Sasuser.One has 0 observations and the data set One
has 3 observations.
c. The data set Sasuser.One has 3 observations and the data set One
has 0 observations.
d. The data set Sasuser.One has 3 observations and the data set One
has 3 observations.
Correct answer: b
Your answer:
There are 2 output data sets listed in the DATA statement: the permanent
data set Sasuser.One and the temporary data set One. The SET statement
reads 3 observations from Work.Two. The OUTPUT statement is used to
explicitly output the 3 observations to the Work.One data set. When the
OUTPUT statement is used, it turns off automatic output in the DATA
step, so any data set that is listed in the DATA statement but not in the
OUTPUT statement will not have any observations written to it. Because
there is no explicit OUTPUT statement for Sasuser.One, the data step
creates Sasuser.One but it has 0 observations.
The MDY function creates a numeric value that represents a SAS date
value. The arguments in the MDY function must be numeric, and they
must represent the values for the month, day, and year (in that order). SAS
date values are calculated as the number of days from January 1, 1960, to
the given date. Therefore, the numeric value 16780 represents the SAS
date value for December 10, 2005.
a. 2
b. 3
c. 6
d. 9
Correct answer: c
Your answer:
The QTR function extracts a value from 1 to 4 from a SAS date value.
This value indicates the quarter of the year in which the date falls. The
quarters are based on a calendar year starting with January. The subsetting
IF statement continues to process only when the observation has a
Sales_date value that falls in the last 2 quarters of the year. Because the
input data set contains one observation for each month in the year 2005,
there are 6 observations written to Work.Report.
a. END
b. EOF
c. PTOBS
d. TOTOBS
Correct answer: a
Your answer:
The END= option creates and names a temporary variable whose value is
1 when the DATA step is processing the last observation (otherwise the
value is 0). PTOBS, EOF, and TOTOBS are not valid SAS options.
One
X Y Z
1 A 27
1 A 33
1 B 45
2 A 52
2 B 69
3 B 70
4 A 82
4 C 91
a. X Y Z
1 A 27
2 A 52
3 B 70
4 A 82
b. X Y Z
1 A 27
1 B 45
2 A 52
2 B 69
3 B 70
4 A 82
4 C 91
c. X Y Z
1 B 45
2 B 69
3 B 70
4 C 91
d. No report is produced. The PRINT procedure fails because the
data set Two is not created in the DATA step.
Correct answer: a
Your answer:
The DROP= data set option specifies which variables are dropped when
the Labdata.Dallas data set is created. If neither the DROP= data set
option nor the KEEP= data set option is used, then all of the variables that
are read from the input data set are included in the output data set. The
KEEP= data set option in the SET statement specifies which variables to
read from the input data set. Therefore, the variables that both output data
sets contain are the variables that are listed in the KEEP= option in the
SET statement and are not listed in the DROP= data set option in the
DATA statement.
The CONTENTS procedure cannot produce the code that created the data
set Sasuser.Airplanes. PROC CONTENTS displays only the descriptor
portion of the data set. To see a listing of the data portion of the data set,
you can use the PRINT procedure or the REPORT procedure.
18. Which SAS procedure displays a listing of the observations in the data
portion of a SAS data set?
a. FSLIST
b. REPORT
c. TABULATE
d. CONTENTS
Correct answer: b
Your answer:
19. The observations in the SAS data set Work.Test are ordered by the values
of the variable Salary. The following SAS program is submitted:
proc sort data=work.test;
<insert statement here>
run;
Which of the following statements completes the program and sorts the
Work.Test data set by Name in descending order?
a. by desc name;
b. by name desc;
c. by descending name;
d. by name descending;
Correct answer: c
Your answer:
The SORT procedure orders SAS data set observations by the values of
one or more character or numeric variables that are listed in the BY
statement. The SORT procedure arranges the data in ascending order by
default. To sort in descending order, the keyword DESCENDING must be
included in the BY statement before the sort variable. The keyword
DESCENDING cannot be abbreviated in the BY statement.
The SORT procedure orders SAS data set observations by the values of
one or more character or numeric variables that are listed in the BY
statement. The SORT procedure re-creates and replaces the original data
with the sorted version of the data if the OUT= option is not used. If the
OUT= data set is used, a new data set is created to hold the sorted data,
and the original data remains unchanged.
21. Which one of the following SAS programs creates a variable named City
with a value of Chicago?
a. data work.airports;
AirportCode='ord';
if AirportCode='ORD' City='Chicago';
run;
b. data work.airports;
AirportCode='ORD';
if AirportCode='ORD' City='Chicago';
run;
c. data work.airports;
AirportCode='ORD';
if AirportCode='ORD' then City='Chicago';
run;
d. data work.airports;
AirportCode='ORD';
if AirportCode='ORD';
then City='Chicago';
run;
Correct answer: c
Your answer:
Two observations are written to the report: one for Patel, and one for
Payne. The WHERE statement uses ?, which is a mnemonic equivalent
for the CONTAINS operator. The CONTAINS operator searched for a
specific set of characters within the values of a character variable. The
position of the string does not matter, but the case does. Because Ellis
contains an uppercase E, it is not included in the report.
a. x=propcase(lname);
b. x=propcase(lname,"'");
c. x=upcase(lname);
d. x=upcase(lname,"'");
Correct answer: b
Your answer:
a. 0
b. 100
c. 200
d. . (missing numeric value)
Correct answer: d
Your answer:
In the RENAME= data set option, you list the old variable name,
followed by an equal sign and the new variable name. You enclose the
variable names in one set of parentheses, and you enclose the entire
RENAME= option in a second set of parentheses.
26. The variable Name in the data set Employee has a format of $CHAR9.
The variable Name in the data set Sales has a format of $CHAR15. The
following SAS program is submitted:
data merged;
merge employee sales;
by name;
format name $CHAR12.;
run;
What is the format for the variable Name in the data set Merged?
a. $CHAR.
b. $CHAR9.
c. $CHAR12.
d. $CHAR15.
Correct answer: c
Your answer:
27. What is true of the sum statement in a SAS DATA step program?
a. It is valid only in conjunction with a SUM function.
b. It is not valid with the SET, MERGE, and UPDATE statements.
c. It adds the value of an expression to an accumulator variable and
ignores missing values.
d. It does not retain the accumulator variable value from one iteration
of the SAS DATA step to the next.
Correct answer: c
Your answer:
28. What is the correct form of the sum statement in a DATA step?
data output;
set one;
address1=<insert code here>;
run;
Which of the following completes the program and changes the word
Court to Drive in the value of the variable Address1?
a. tranwrd(address1,'Court','Drive')
b. trantab(address1,'Court','Drive')
c. translate(address1,'Court','Drive')
d. transform(address1,'Court','Drive')
Correct answer: a
Your answer:
a. Guide
b. ide t
c. s Guid
d. Guide to the SAS Language
Correct answer: a
Your answer:
data work.month;
date=put('13mar2000'd,ddmmyy10.);
run;
What are the type and length of the variable Date in the output data set?
33. A SAS program is submitted and the following is written to the SAS log:
SAS Log
178 data days;
179 do i='SUN' 'MON' 'TUES';
----- ------
388 200
ERROR 388-185: Expecting an arithmetic operator.
180 day=i!!'DAY';
181 end;
182 run;
What
caused the error?
data work.clients;
calls=6;
do while(calls le 6);
calls+1;
end;
calls+1;
run;
The DO WHILE loop checks the validity of the expression at the top of
the loop and executes as long as the expression is true. When the
expression is false, the DO loop does not execute. In this program, the
value of Calls is set to 6 in the assignment statement at the beginning of
the DATA step. Therefore, the expression in the DO/WHILE loop is true
and the loop executes once. The loop increases the value of Calls to 7, so
the loop expression fails and the DATA step continues with the sum
statement. At the end of the DATA step, the value of Calls is 8.
data stats;
set revenue;
array weekly{5} mon tue wed thu fri;
<insert DO statement here>
total=weekly{i}*.25;
output;
end;
run;
a. do i=1-5;
b. do i=1 to 5;
c. do weekly=1 to 5;
d. do weekly{i}=1 to 5;
Correct answer: b
Your answer:
A simple DO loop can be used to process the elements in the array. When
you define a DO loop that processes elements in an array, the index
variable name should also be the name that is used for the subscript of the
array reference.
data work.test;
array diff_sales{3};
run;
Style Asking
of homes price
$80,050
CONDO
$79,350
$55,850
TWOSTORY
$69,250
Which of the following DEFINE
statements completes the program and produces the desired output?
The detail report shown uses the variables Style and Price. The Style
variable is specified as an order variable by the ORDER usage option in
the DEFINE statement. The DISPLAY usage option would print a detail
report listing all of the values of Style. The GROUP usage option would
suppress the repetitious printing of Style, but it would collapse all rows
with the same Style value into one row.
3 2.5 $79,350
4 2.5 $127,150
2 2.0 $110,700
TWOSTORY 4 3.0 $107,250
2 1.0 $55,850
2 1.0 $569,250
4 2.5 $102,950
Which of the
following SAS statements completes the program and creates the desired
report?
a. id style;
var bedroom baths price;
b. id style;
var style bedrooms baths price;
c. id style;
by style;
var bedrooms baths price;
d. id style;
by style;
var style bedrooms baths price;
Correct answer: c
Your answer:
The ID statement prints the ID variable as the left-most column and
suppresses the OBS column. If you specify a variable in the ID statement
and that same variable is listed in the VAR statement, then the variable
appears twice in the report. The report lists the ID variable once for each
BY group when you use the ID statement and the BY statement together,
with the same variable listed in both statements. The BY lines are also
suppressed in the report, and the value of the ID variable identifies the BY
group.
The SAS data set Class has two character variables and three numeric
variables. How many tables are generated?
a. 0
b. 2
c. 3
d. 5
Correct answer: d
Your answer:
a. class style;
b. var bedrooms baths;
c. class style;
var bedrooms baths;
d. var style;
class bedrooms baths;
Correct answer: c
Your answer:
In the desired report, the variable Style is a grouping variable, and the
variables Bedrooms and Baths are analyzed. In the MEANS procedure,
the CLASS statement specifies grouping variables. The VAR statement
specifies which numeric variables are analyzed.
a. 1
b. 2
c. 5
d. 6
Correct answer: d
Your answer:
The PAGENO= option specifies a starting page number for the output.
The page numbers increment by 1, starting with the value in the
PAGENO= option. If the PRINT procedure generates five pages of
output, then the MEANS procedure output will start on page 6. If you
move the OPTIONS statement after the PRINT procedure, the MEANS
procedure output would start on page 1.
data test;
set ia.flts_pts;
if job_code='fltat3'
then description='Flight Attendant';
length description 8;
run;
The variable Job_code is a character variable with a length of 6 bytes.
What is the result?
The DATA step fails because of errors. The LENGTH statement can be
used to assign a length to a character or numeric variable. When this code
is compiled, SAS encounters description in the assignment statement
before the LENGTH statement, and description is set to a character
variable with a length of 16. When the LENGTH statement compiles,
there is a conflict because the LENGTH statement attempts to assign a
numeric length to the character variable Description, and the step fails
because of the error.
46. The descriptor and data portions of the Work.Salaries data set are shown
below.
In order to output the desired observations, you must specify the value in
the WHERE statement as a character value. Salary is defined as a
character variable. The variable and value that are referenced in the
WHERE statement must be of the same type.
48. Which one of the following TITLE statements displays Jane's Dog as the
title of SAS output?
To hide an unmatched single quotation mark, you surround the title text
with matched double quotation marks. SAS expects single and double
quotation marks to be in pairs.
49. The data set Work.Allmonths contains four quarters of data. A DATA
step is submitted and a portion of the SAS log is shown below.
SAS Log
208 data arrays;
209 set work.allmonths(keep=quarter num_sold);
210 by quarter;
211 array sold{3};
212 if first.quarter then cnt=1;
213 sold{cnt}=num_sold;
214 cnt+1;
215 if last.quarter then output;
216 run;
There are three dimensions in the sold array and four quarters of data.
When the Cnt variable has a value of 4, the value exceeds the specified
range in the array and causes SAS to stop processing. Because there are
four quarters, increasing the array dimension value to 4 will accommodate
all of the elements within the array.
a. _N_
b. _ERROR_
c. _NUMERIC_
d. _CHARACTER_
Correct answer: b
Your answer:
Copyright © 2006 SAS Institute Inc., Cary, NC, USA. All rights reserved.
Terms of Use & Legal Information | Privacy Statement