<?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: Merging data sets in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Merging-data-sets/m-p/737949#M28836</link>
    <description>&lt;P&gt;Did you look at the output? Do the actual variables make sense?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MERGE in SAS is a side-by-side operation.&lt;/P&gt;
&lt;P&gt;From the number of observations you say you expect then it appears you want to STACK the data which would be a SET not merge.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you code is doing is aligning records based on the By variables. So if&amp;nbsp; LI_SALE_NUMBER has the same value in two sets the record is combined into one. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example of the difference between the MERGE and SET;&lt;/P&gt;
&lt;PRE&gt;data two;
  input x z;
datalines;
1 111
3 333
4 444
;

data example1;
   merge one two;
   by x;
run;

data example2;
   set one two;
   by x;
run;&lt;/PRE&gt;
&lt;P&gt;The result:&lt;/P&gt;
&lt;PRE&gt;Example 1                                                           

x     y     z
1    11    111
2    22      .
3    33    333
4     .    444

Example 2                                                          

x     y     z
1    11      .
1     .    111
2    22      .
3    33      .
3     .    333
4     .    444

&lt;/PRE&gt;</description>
    <pubDate>Thu, 29 Apr 2021 15:24:51 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-04-29T15:24:51Z</dc:date>
    <item>
      <title>Merging data sets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-data-sets/m-p/737943#M28834</link>
      <description>&lt;P&gt;I am trying to merge 3 datasets that have independent IDs, but it only merge some observations instead of all of them&amp;nbsp;&lt;/P&gt;&lt;P&gt;my code is as below and those datasets together should be above 4000 observations however, it only give me 2878 (as shown in the picture below from the log).&lt;/P&gt;&lt;P&gt;does anyone knows what am I doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA AUCTION.TRUCKS;
 MERGE AUCTION.CHEVROLET (IN=A) auction.dodge (IN=B) auction.ford (IN=C) ;
 BY LI_SALE_NUMBER;
 IF A OR B OR C;
RUN;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Lety08_0-1619708884480.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58870iA88E033503E3C266/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Lety08_0-1619708884480.png" alt="Lety08_0-1619708884480.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 15:09:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-data-sets/m-p/737943#M28834</guid>
      <dc:creator>Lety08</dc:creator>
      <dc:date>2021-04-29T15:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Merging data sets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-data-sets/m-p/737948#M28835</link>
      <description>&lt;P&gt;You have matching values for LI_SALE_NUMBER in those datasets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure you want a MERGE, and not stacking the datasets with a SET statement?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 15:16:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-data-sets/m-p/737948#M28835</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-29T15:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: Merging data sets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-data-sets/m-p/737949#M28836</link>
      <description>&lt;P&gt;Did you look at the output? Do the actual variables make sense?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MERGE in SAS is a side-by-side operation.&lt;/P&gt;
&lt;P&gt;From the number of observations you say you expect then it appears you want to STACK the data which would be a SET not merge.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you code is doing is aligning records based on the By variables. So if&amp;nbsp; LI_SALE_NUMBER has the same value in two sets the record is combined into one. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example of the difference between the MERGE and SET;&lt;/P&gt;
&lt;PRE&gt;data two;
  input x z;
datalines;
1 111
3 333
4 444
;

data example1;
   merge one two;
   by x;
run;

data example2;
   set one two;
   by x;
run;&lt;/PRE&gt;
&lt;P&gt;The result:&lt;/P&gt;
&lt;PRE&gt;Example 1                                                           

x     y     z
1    11    111
2    22      .
3    33    333
4     .    444

Example 2                                                          

x     y     z
1    11      .
1     .    111
2    22      .
3    33      .
3     .    333
4     .    444

&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Apr 2021 15:24:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-data-sets/m-p/737949#M28836</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-29T15:24:51Z</dc:date>
    </item>
  </channel>
</rss>

