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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 1341 views
  • 0 likes
  • 2 in conversation