<?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: Combining data set in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Combining-data-set/m-p/612508#M178749</link>
    <description>&lt;P&gt;Can you provide two small example data sets&amp;nbsp;similar to your start and what you would want for the output?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you did not show either a SET, MERGE, UPDATE or MODIFY statement in your example code it isn't possible to tell exactly what you may have done previously.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A SET statement would stack the data sets with no loss&lt;/P&gt;
&lt;PRE&gt;data merged;
   set dataset1 (in=a) dataset2 (in=b);
run;&lt;/PRE&gt;
&lt;P&gt;This assumes all of your variables in common between the two sets have the same type (numeric or character) and length. Different lengths will generate messages and possibly truncated data. Different types will not allow the combination to proceed as that would be an error.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Dec 2019 18:59:19 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-12-17T18:59:19Z</dc:date>
    <item>
      <title>Combining data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-data-set/m-p/612506#M178748</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 2 data sets that have roughly the same data. Some of the variables overlap (i.e. name, dob, etc.) and some of the variables are exclusive to 1 data set or the other. I need to keep everything from both data sets.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Typically I would use something like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;data merged;&lt;BR /&gt;dataset1 (in=a) dataset2 (in=b);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For these 2 data sets both have an ID that is for each patient, however some of the IDs duplicate between the 2 data sets. I need to keep both of the duplicate IDs without losing any of their information.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is their a way to essentially stack the 2 data sets together without losing the information in the duplicate IDs? Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 18:53:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-data-set/m-p/612506#M178748</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-12-17T18:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: Combining data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-data-set/m-p/612508#M178749</link>
      <description>&lt;P&gt;Can you provide two small example data sets&amp;nbsp;similar to your start and what you would want for the output?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you did not show either a SET, MERGE, UPDATE or MODIFY statement in your example code it isn't possible to tell exactly what you may have done previously.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A SET statement would stack the data sets with no loss&lt;/P&gt;
&lt;PRE&gt;data merged;
   set dataset1 (in=a) dataset2 (in=b);
run;&lt;/PRE&gt;
&lt;P&gt;This assumes all of your variables in common between the two sets have the same type (numeric or character) and length. Different lengths will generate messages and possibly truncated data. Different types will not allow the combination to proceed as that would be an error.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 18:59:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-data-set/m-p/612508#M178749</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-12-17T18:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Combining data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-data-set/m-p/612509#M178750</link>
      <description>&lt;P&gt;Without samples of what you have and what you want, my dumb brain isn't able to guess your exact requirement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you after this by any chance?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data merged;
set dataset1 dataset2 ;
run;

 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;EDIT :&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp; &amp;nbsp;Sorry sir, i didn't see your message. My apologies for the duplication of the same approaches.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 19:01:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-data-set/m-p/612509#M178750</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-12-17T19:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: Combining data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-data-set/m-p/612551#M178770</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT :&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp; &amp;nbsp;Sorry sir, i didn't see your message. My apologies for the duplication of the same approaches.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No worries. Sometimes different phrasing makes more sense to one person than another. Better to get at least one answer the OP can&amp;nbsp;understand than none.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We also know that responses can be close in time because one response wasn't posted at the time you read a question but appears at about the same time when posting responses.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 22:48:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-data-set/m-p/612551#M178770</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-12-17T22:48:56Z</dc:date>
    </item>
  </channel>
</rss>

