<?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 Merge that Keeps the Smaller Dataset Structure in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merge-that-Keeps-the-Smaller-Dataset-Structure/m-p/357608#M83986</link>
    <description>&lt;P&gt;Is there a merge function that combines columns from two datasets while only updating the smaller dataset with the first value of the larger dataset?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;E.g. Dataset 1&lt;/P&gt;&lt;P&gt;A&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset 2&lt;/P&gt;&lt;P&gt;A orange&lt;/P&gt;&lt;P&gt;A blue&lt;/P&gt;&lt;P&gt;B pink&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result dataset&lt;/P&gt;&lt;P&gt;A orange&lt;/P&gt;&lt;P&gt;B pink&lt;/P&gt;</description>
    <pubDate>Wed, 10 May 2017 17:55:45 GMT</pubDate>
    <dc:creator>DavidPhillips2</dc:creator>
    <dc:date>2017-05-10T17:55:45Z</dc:date>
    <item>
      <title>Merge that Keeps the Smaller Dataset Structure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-that-Keeps-the-Smaller-Dataset-Structure/m-p/357608#M83986</link>
      <description>&lt;P&gt;Is there a merge function that combines columns from two datasets while only updating the smaller dataset with the first value of the larger dataset?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;E.g. Dataset 1&lt;/P&gt;&lt;P&gt;A&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset 2&lt;/P&gt;&lt;P&gt;A orange&lt;/P&gt;&lt;P&gt;A blue&lt;/P&gt;&lt;P&gt;B pink&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result dataset&lt;/P&gt;&lt;P&gt;A orange&lt;/P&gt;&lt;P&gt;B pink&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 17:55:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-that-Keeps-the-Smaller-Dataset-Structure/m-p/357608#M83986</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2017-05-10T17:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: Merge that Keeps the Smaller Dataset Structure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-that-Keeps-the-Smaller-Dataset-Structure/m-p/357614#M83990</link>
      <description>&lt;P&gt;This generates the desired result. I won't promise it is extensible for all cases.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data work.data1;
   input a $;
datalines;
A
B
;
run;
data work.data2;
   input a $ color $;
datalines;
A orange
A blue
B pink
;
run;

data work.try;
   merge work.data1 work.data2;
   by a;
   if first.a;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 May 2017 18:08:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-that-Keeps-the-Smaller-Dataset-Structure/m-p/357614#M83990</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-10T18:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: Merge that Keeps the Smaller Dataset Structure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-that-Keeps-the-Smaller-Dataset-Structure/m-p/357615#M83991</link>
      <description>&lt;P&gt;Not sure if this is what you are asking, but this gives the desired output&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dataset1;
input var1 $;
datalines;
A
B
;

data dataset2;
input var1 $ var2 $;
datalines;
A orange
A blue
B pink
;

proc sort data = dataset1;
   by var1;
run;

proc sort data = dataset2;
   by var1;
run;

data want;
   merge dataset1 dataset2;
   by var1;
   if first.var1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 May 2017 18:10:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-that-Keeps-the-Smaller-Dataset-Structure/m-p/357615#M83991</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-05-10T18:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Merge that Keeps the Smaller Dataset Structure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-that-Keeps-the-Smaller-Dataset-Structure/m-p/357618#M83993</link>
      <description>&lt;P&gt;Ballardw,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks I forgot about first dot.&amp;nbsp; Happy letters and colors pair up now.&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 18:11:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-that-Keeps-the-Smaller-Dataset-Structure/m-p/357618#M83993</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2017-05-10T18:11:24Z</dc:date>
    </item>
  </channel>
</rss>

