a. The values of Age in the 1st data set overwrite the values of Age in the 2nd data set.
b. The values of Age in the 2nd data set overwrite the values of Age in the 1st data set.
c. The DATA step fails because the two data sets contain same-named variables that have different values.
d. The values of Age in the 2nd data set are set to missing.
Question 6
Question
Suppose you merge data sets Health.Set1 and Health.Set2 below:
Which output does the following program create?
data work.merged;
merge health.set1( in = in1) health.set2( in = in2);
by id;
if in1 and in2;
run;
proc print data = work.merged;
run;
The data sets Ensemble.Spring and Ensemble.Summer both contain a variable named Blue. How do you prevent the values of the variable Blue from being overwritten when you merge the two data sets?
Answer
a. data ensemble.merged;
merge ensemble.spring( in = blue)
ensemble.summer;
by fabric;
run;
b. data ensemble.merged;
merge ensemble.spring( out = blue)
ensemble.summer;
by fabric;
run;
c. data ensemble.merged;
merge ensemble.spring( blue = navy)
ensemble.summer;
by fabric;
run;
d. data ensemble.merged;
merge ensemble.spring( rename =( blue = navy))
ensemble.summer;
by fabric;
run;
Question 8
Question
What happens if you submit the following program to merge Blood.Donors1 and Blood.Donors2, shown below?
data work.merged;
merge blood.donors1 blood.donors2;
by id;
run