BookmarkSubscribeRSS Feed
richard_hu2003
Calcite | Level 5
Given the following SAS data sets ONE and TWO: The following
SAS DATA step is submitted:
data combine;
merge one two;
by common;
run;
Which one of the following represents the data values stored
in data set COMBINE?
ONE
OBS COMMON X
1 A 10
2 A 13
3 A 14
4 B 9
5 C 8
6 C 14
TWO
OBS COMMON Y
1 A 1
2 A 3
3 B 4
4 B 2
5 C 5
(A) OBS COMMON X Y
1 A 10 1
2 A 13 3
3 A 14 3
4 B 9 4
5 B 9 2
6 C 8 5
7 C 14 5
(B) OBS COMMON X Y
1 A 10 1
2 A 13 3
3 B 9 4
4 C 8 5
(C) OBS COMMON X Y
1 A 10 1
2 A 13 3
3 B 14 4
4 B 9 2
5 C 8 5
(D) OBS COMMON X Y
1 A 10 1
2 A 13 1
3 A 14 1
4 A 10 3
5 A 13 3
6 A 14 3
7 B 9 4
8 B 9 2
9 C 8 5
10 C 14 5

Answer is (A). But why not (D)? Thanks.
2 REPLIES 2
SPR
Quartz | Level 8 SPR
Quartz | Level 8
Hello Richard_hu2003,

Yes, the answer is A. It is impossible to be D because with this type of merging the combine dataset should contain only three observations for COMMON='A'. The rules of merging are quite complicated and explained in SAS help and relevant books..

Sincerely,
richard_hu2003
Calcite | Level 5
Thank you so much! SPR

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1523 views
  • 0 likes
  • 2 in conversation