This example is a case
of one-to-one matching, which requires multiple SET statements. Where
same-named variables occur, values that are read from the second data
set replace those that are read from the first data set. Also, the
number of observations in the new data set is the number of observations
in the smallest original data set.
Correct answer: b
This is a case of concatenation,
which requires a list of data set names in the SET statement and one
or more BY variables in the BY statement. Notice that observations
in each BY group are read sequentially, in the order in which the
data sets and BY variables are listed. The new data set contains all
the variables from all the input data sets, as well as the total number
of records from all input data sets.
Correct answer: a
Concatenating appends
the observations from one data set to another data set. The new data
set contains the total number of records from all input data sets,
so b is incorrect. All the variables from all the input data sets
appear in the new data set, so c is incorrect.
Correct answer: a
The concatenated data
sets are read sequentially, in the order in which they are listed
in the SET statement. The second observation in Work.Reps does not
contain a value for Sale, so a missing value appears for this variable.
(Note that if you merge the data sets, the value of Sale for the second
observation is $30,000.)
Correct answer: b
If you have variables
with the same name in more than one input data set, values of the
same-named variable in the first data set in which it appears are
overwritten by values of the same-named variable in subsequent data
sets.
Correct answer: a
The DATA step uses the
IN= data set option, and the subsetting IF statement excludes unmatched
observations from the output data set. So, answers a and b, which
contain unmatched observations, are incorrect.
Correct answer: d
Match-merging overwrites
same-named variables in the first data set with same-named variables
in subsequent data sets. To prevent overwriting, rename variables
by using the RENAME= data set option in the MERGE statement.
Correct answer: c
The two input data sets
are not sorted by values of the BY variable, so the DATA step produces
errors and stops processing.
Correct answer: c
In this example, the
new data set contains one observation for each unique value of ID.
The new data set is shown below.
Correct answer: a
In the new data set,
the third observation is the second observation for ID number 2 (Kelly
Windsor). The value for Bonus is retained from the previous observation
because the BY variable value did not change. The new data set is
shown below.