BookmarkSubscribeRSS Feed
Saszealot
Calcite | Level 5
With reference to the above topic,I need some help beginning from the highlighted lines below. This is the explanation SAS gave to question 32. I 'm not in agreement with their explanation.
Thanks.
Given the following SAS data sets One and Two:
One
Obs Common X
1 A 10
2 A 13
3 A 14
4 B 9


Two
Obs Common Y
1 A 1
2 A 3
3 B 4
4 B 2

The following SAS program is submitted:
data combine;
merge one two;
by common;
run;

What data values are stored in the data set Combine?



The MERGE statement in the DATA step processes data sequentially. The first observation of data set One is combined with the first observation of data set Two because the variable Common has a value of A in both data sets.
The second observation of the data set One is combined with the second observation of the data set Two because the variable Common has a value of A in both data sets. Because there is an additional observation in the data set Two where the variable Common has a value of A, the program data vector is not reinitialized; the value of X is retained from observation two, and the values of Common and Y are read from the data set Two. Thus, there are three observations in the data set Combine where the variable Common has a value of A.
The third observation of the data set One is combined with the fourth observation of the data set Two because the variable Common has a value of B in both data sets.
Finally, the fourth observation of the data set One is combined with the last observation of the data set Two because the variable Common has a value of B in both data sets. Thus, there are two observations in the data set Combine where the variable Common has a value of B.
2 REPLIES 2
LinusH
Tourmaline | Level 20
I take it that the bold sentence is bothering you.
This is probably a typo, I think it should read "..in the data set One...".

/Linus
Data never sleeps
Flip
Fluorite | Level 6
Clearly the paragraph does not match the data.

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!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

Discussion stats
  • 2 replies
  • 799 views
  • 0 likes
  • 3 in conversation