<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Combine two data sets using SET statements in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Combine-two-data-sets-using-SET-statements/m-p/50716#M10597</link>
    <description>When multiple SET statements are used, number of observations in the new data set is the number of observations in the smallest original data set. If the data sets contain common variables, the values that are read in from the last data set replace those read in from earlier ones.&lt;BR /&gt;
&lt;BR /&gt;
During the third iteration, when the record is read using SET statement from FIRST dataset, the value of 'Common' in PDV is A. However, when the second SET statement is executed, the value of 'Common' (A) in PDV is replaced by 'B' from SECOND dataset.</description>
    <pubDate>Thu, 14 Apr 2011 19:49:09 GMT</pubDate>
    <dc:creator>NickR</dc:creator>
    <dc:date>2011-04-14T19:49:09Z</dc:date>
    <item>
      <title>Combine two data sets using SET statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-two-data-sets-using-SET-statements/m-p/50715#M10596</link>
      <description>Given the SAS data sets:&lt;BR /&gt;
WORK.FIRST WORK.SECOND&lt;BR /&gt;
Common X Common Y&lt;BR /&gt;
------ -- ------ --&lt;BR /&gt;
A 10 A 1&lt;BR /&gt;
A 13 A 3&lt;BR /&gt;
A 14 B 4&lt;BR /&gt;
B 9 B 2&lt;BR /&gt;
The following SAS program is submitted:&lt;BR /&gt;
data WORK.COMBINE;&lt;BR /&gt;
set WORK.FIRST;&lt;BR /&gt;
set WORK.SECOND;&lt;BR /&gt;
run;&lt;BR /&gt;
What data values are stored in data&lt;BR /&gt;
set WORK.COMBINE?&lt;BR /&gt;
A.&lt;BR /&gt;
Common X Y&lt;BR /&gt;
------ -- --&lt;BR /&gt;
A 10 1&lt;BR /&gt;
A 13 3&lt;BR /&gt;
B 14 4&lt;BR /&gt;
B 9 2&lt;BR /&gt;
B.&lt;BR /&gt;
Common X Y&lt;BR /&gt;
------ -- --&lt;BR /&gt;
A 10 1&lt;BR /&gt;
A 13 3&lt;BR /&gt;
A 14 3&lt;BR /&gt;
B 9 4&lt;BR /&gt;
B 9 2&lt;BR /&gt;
C.&lt;BR /&gt;
Common X Y&lt;BR /&gt;
------ -- --&lt;BR /&gt;
A 10 1&lt;BR /&gt;
A 13 3&lt;BR /&gt;
A 14 .&lt;BR /&gt;
B 9 4&lt;BR /&gt;
B . 2&lt;BR /&gt;
D.&lt;BR /&gt;
Common X Y&lt;BR /&gt;
------ -- --&lt;BR /&gt;
A 10 1&lt;BR /&gt;
A 13 1&lt;BR /&gt;
A 14 1&lt;BR /&gt;
A 10 3&lt;BR /&gt;
A 13 3&lt;BR /&gt;
A 14 3&lt;BR /&gt;
B 9 4&lt;BR /&gt;
B 9 2&lt;BR /&gt;
Answer:(A)&lt;BR /&gt;
&lt;BR /&gt;
I don't understand that the third row starts with "B" instead of "A" in answer (A). Why? Can someone help? Thanks.

Message was edited by: richard_hu2003</description>
      <pubDate>Thu, 14 Apr 2011 18:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-two-data-sets-using-SET-statements/m-p/50715#M10596</guid>
      <dc:creator>richard_hu2003</dc:creator>
      <dc:date>2011-04-14T18:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Combine two data sets using SET statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-two-data-sets-using-SET-statements/m-p/50716#M10597</link>
      <description>When multiple SET statements are used, number of observations in the new data set is the number of observations in the smallest original data set. If the data sets contain common variables, the values that are read in from the last data set replace those read in from earlier ones.&lt;BR /&gt;
&lt;BR /&gt;
During the third iteration, when the record is read using SET statement from FIRST dataset, the value of 'Common' in PDV is A. However, when the second SET statement is executed, the value of 'Common' (A) in PDV is replaced by 'B' from SECOND dataset.</description>
      <pubDate>Thu, 14 Apr 2011 19:49:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-two-data-sets-using-SET-statements/m-p/50716#M10597</guid>
      <dc:creator>NickR</dc:creator>
      <dc:date>2011-04-14T19:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Combine two data sets using SET statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-two-data-sets-using-SET-statements/m-p/50717#M10598</link>
      <description>Very detailed explanation. Thanks, Nick!</description>
      <pubDate>Thu, 14 Apr 2011 20:00:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-two-data-sets-using-SET-statements/m-p/50717#M10598</guid>
      <dc:creator>richard_hu2003</dc:creator>
      <dc:date>2011-04-14T20:00:17Z</dc:date>
    </item>
  </channel>
</rss>

