BookmarkSubscribeRSS Feed
richard_hu2003
Fluorite | Level 6
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
Fluorite | Level 6
Thank you so much! SPR

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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