<?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: dataset merge in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/dataset-merge/m-p/375848#M90150</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132719"&gt;@echoli&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for the answer, I've provide a sample data.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There's no data in the post?&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jul 2017 21:46:55 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-07-13T21:46:55Z</dc:date>
    <item>
      <title>dataset merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dataset-merge/m-p/375828#M90140</link>
      <description>&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two datasets (A and B) with the same variable names ID, Test 1, Test2.&lt;/P&gt;&lt;P&gt;I want to merge A and B but&amp;nbsp;&lt;SPAN&gt;if A and B have the same ID, than use records in A, not in B.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried to use left join, seems not correct. Any cues?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data a;
	input ID test1 test2;
	datalines;
123 33 55
372 23 48
763 13 85
;

data b;
	input ID test1 test2;
	datalines;
568 41 36
587 23 48
763 25 69
;


&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 21:48:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dataset-merge/m-p/375828#M90140</guid>
      <dc:creator>echoli</dc:creator>
      <dc:date>2017-07-13T21:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: dataset merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dataset-merge/m-p/375832#M90142</link>
      <description>&lt;P&gt;Please post sample data in the form of a data step&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 20:56:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dataset-merge/m-p/375832#M90142</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-07-13T20:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: dataset merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dataset-merge/m-p/375833#M90143</link>
      <description>&lt;P&gt;You're leaving out many important details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does an ID ever appear more than once in the same data set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If an ID appears in B but not in A, do you still want to keep that ID?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If an ID appears in both data sets A and B, but TEST1 and TEST2 have missing values in A, do you want to use the values in B?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do your actual data sets really contain just 3 variables, or do they contain many more than 3?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In all likelihood, the programming will be simple.&amp;nbsp; The difficult part is figuring out what the results should be.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 21:00:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dataset-merge/m-p/375833#M90143</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-13T21:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: dataset merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dataset-merge/m-p/375837#M90144</link>
      <description>&lt;P&gt;Thanks for the answer, I've provide a sample data.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 21:20:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dataset-merge/m-p/375837#M90144</guid>
      <dc:creator>echoli</dc:creator>
      <dc:date>2017-07-13T21:20:45Z</dc:date>
    </item>
    <item>
      <title>Re: dataset merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dataset-merge/m-p/375848#M90150</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132719"&gt;@echoli&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for the answer, I've provide a sample data.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There's no data in the post?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 21:46:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dataset-merge/m-p/375848#M90150</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-13T21:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: dataset merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dataset-merge/m-p/375849#M90151</link>
      <description>&lt;PRE&gt;data a;
	input ID test1 test2;
	datalines;
123 33 55
372 23 48
763 13 85
;

data b;
	input ID test1 test2;
	datalines;
568 41 36
587 23 48
763 25 69
;


&lt;/PRE&gt;&lt;P&gt;can you see it now?&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;LI-SPOILER&gt;&amp;nbsp;&lt;/LI-SPOILER&gt;</description>
      <pubDate>Thu, 13 Jul 2017 21:49:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dataset-merge/m-p/375849#M90151</guid>
      <dc:creator>echoli</dc:creator>
      <dc:date>2017-07-13T21:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: dataset merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dataset-merge/m-p/375856#M90154</link>
      <description>&lt;P&gt;If the ID is not duplicated in either set then this may do what you want;&lt;/P&gt;
&lt;PRE&gt;/* data step merge by requires sorted data*/
proc sort data=a;
  by id;
run;
proc sort data=b;
by id;
run;

data want;
   merge b a;
   by id;
run;&lt;/PRE&gt;
&lt;P&gt;Sorts included even though example data already sorted just in case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 22:24:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dataset-merge/m-p/375856#M90154</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-07-13T22:24:24Z</dc:date>
    </item>
  </channel>
</rss>

