- Which of the following statements is true about merging SAS data sets by using the DATA step?
- Which of the following programs concatenates the data sets sales and products, in that order?
- If you run this DATA step, what observations does the data set bonuses contain?
date bonuses;
merge managers staff;
by EmpID;
run;
- If you concatenate the data sets below in the order shown, what is the value of Sale in observaton 2 of the new data set?
reps
ID |
Name
|
1 |
Nay Rong |
2 |
Kelly Windsor |
3 |
Julio Meraz |
4 |
Richard Krabill |
|
close
ID |
Sale
|
1 |
$28,000 |
2 |
$30,000 |
2 |
$40,000 |
3 |
$15,000 |
3 |
$20,000 |
3 |
$25,000 |
4 |
$35,000 |
|
- What happens if you submit the following program to merge donors1 and donors2, shown below?
data merged;
merge donors1 donors2;
by ID;
run;
donors1
ID |
Type |
Units
|
2304 |
O |
16 |
1129 |
A |
48 |
1129 |
A |
50 |
1129 |
A |
57 |
2486 |
B |
63 |
|
donors2
ID |
Code |
Units
|
6488 |
65 |
27 |
1129 |
63 |
32 |
5438 |
62 |
39 |
2304 |
61 |
45 |
1387 |
64 |
67 |
|
- Suppose you want to concatenate these data sets. Which DATA step creates an output data set that combines the values of Color and Hue in the single variable Color?
widget1
Tag |
Color |
Model |
77904 |
blue |
AB42 |
56012 |
red |
BA25 |
35499 |
orange |
FC36 |
|
widget2
Tag |
Hue |
Model |
89325 |
red |
SP17 |
65888 |
yellow |
BA12 |
00167 |
green |
PG20 |
|
- What is the syntax error in this DATA step?
data returns_qtr1;
set returns_jan(rename=(ID=CustID)
(Return=Item))
returns_feb(rename=(Dt=Date))
returns_mar;
run;
- In the second iteration of this DATA step, after the data has been merged, what are the values of C and A?
data client_amount;
merge clients(in=C)
amounts(in=A);
by Name;
run;
clients
Name |
EmpID |
Ankerton |
11123 |
Davis |
22293 |
Masters |
33351 |
Wolmer |
44483 |
|
amounts
Name |
Date |
Amt
|
Ankerton |
08OCT96 |
92 |
Ankerton |
15OCT96 |
43 |
Davis |
04OCT96 |
16 |
Masters |
. |
27 |
Thomas |
21OCT96 |
15 |
|
- If you run this DATA step, what observations does the data set bonuses contain?
data bonuses;
merge managers (in=M)
staff (in=S);
by EmpID;
if M=0 and S=1;
run;
- What is the relationship of the data set first to the data set second when merged by the variable ID?
first
Name |
ID |
Age
|
Togar |
121150 |
39 |
Kylie |
121152 |
34 |
Birin |
121153 |
32 |
Gloria |
121154 |
12 |
James |
121155 |
36 |
Gene |
121156 |
28 |
Tom |
121157 |
27 |
|
second
ID |
Date |
121150 |
02/15/05 |
121152 |
05/22/07 |
121153 |
03/04/06 |
121154 |
11/22/05 |
121155 |
07/08/06 |
121156 |
12/15/06 |
121157 |
04/30/07 |
|
|