<?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: Need help with Merge in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Merge/m-p/367871#M263580</link>
    <description>&lt;P&gt;My guess is that you have a duplicate in file b. e.g.:&lt;/P&gt;
&lt;PRE&gt;data a;
  input common_variable $50.;
  cards;
1
2
3
4
5
;
data b;
  input common_variable $50.;
  cards;
1
2
3
3
4
5
;
 
data AB AB_dummy;
  length common_variable $ 50;
  merge A (in=a) B (in=b);
  by common_variable;
  if a then output AB;
  if a and not b then output AB_dummy;
run;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jun 2017 19:53:53 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-06-16T19:53:53Z</dc:date>
    <item>
      <title>Need help with Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Merge/m-p/164186#M263578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I am merging 2 datasets- A and B with 247 and 18 observations respectively as below , I am getting 248 observations in the dataset AB. Is this correct?&lt;/P&gt;&lt;P&gt;As much as I know, the no.of observations in the new dataset AB should be 247. Need help in solving this problem. Appreciate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data AB AB_dummy;&lt;/P&gt;&lt;P&gt;length common_variable $ 50;&lt;/P&gt;&lt;P&gt;merge A (in=a) B (in=b);&lt;/P&gt;&lt;P&gt;by common_variable;&lt;/P&gt;&lt;P&gt;if a then output AB;&lt;/P&gt;&lt;P&gt;if a and not b then output AB_dummy;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Aug 2014 08:29:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Merge/m-p/164186#M263578</guid>
      <dc:creator>vjpkr</dc:creator>
      <dc:date>2014-08-17T08:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Merge/m-p/367865#M263579</link>
      <description>&lt;P&gt;Most likely there is 1 common variable that is in A and also in B. Thus, when you condition on 'if a then output AB' you are picking up 247 observations from dataset A and 1 observation from dataset B, yielding 248 total observations in dataset AB.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 19:42:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Merge/m-p/367865#M263579</guid>
      <dc:creator>Rwon</dc:creator>
      <dc:date>2017-06-16T19:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Merge/m-p/367871#M263580</link>
      <description>&lt;P&gt;My guess is that you have a duplicate in file b. e.g.:&lt;/P&gt;
&lt;PRE&gt;data a;
  input common_variable $50.;
  cards;
1
2
3
4
5
;
data b;
  input common_variable $50.;
  cards;
1
2
3
3
4
5
;
 
data AB AB_dummy;
  length common_variable $ 50;
  merge A (in=a) B (in=b);
  by common_variable;
  if a then output AB;
  if a and not b then output AB_dummy;
run;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 19:53:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-with-Merge/m-p/367871#M263580</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-06-16T19:53:53Z</dc:date>
    </item>
  </channel>
</rss>

