<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472277#M121076</link>
    <description>&lt;P&gt;There still needs to be more clarification.&lt;/P&gt;
&lt;P&gt;Record 102 has 3 records in table 1 and 3 records in table 2.&lt;/P&gt;
&lt;P&gt;How many records do you expect as output? What &lt;U&gt;&lt;STRONG&gt;exactly&lt;/STRONG&gt;&lt;/U&gt; are you expecting as output?&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212762"&gt;@Dhana18&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;would like to have merged data set without losing data from both table.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jun 2018 19:51:01 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-06-21T19:51:01Z</dc:date>
    <item>
      <title>Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472262#M121068</link>
      <description>&lt;P&gt;Hello I am trying to merge two data sets with a variable that is repeated in both data sets. For example;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; cm;&lt;/P&gt;&lt;P&gt;infile cards;&lt;/P&gt;&lt;P&gt;input pid &lt;STRONG&gt;1&lt;/STRONG&gt;-&lt;STRONG&gt;3&lt;/STRONG&gt; @&lt;STRONG&gt;5&lt;/STRONG&gt; date date9. medication $&lt;STRONG&gt;15&lt;/STRONG&gt;-&lt;STRONG&gt;35&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;format date date9.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;101 16Nov2009&amp;nbsp;GCNAAT&lt;/P&gt;&lt;P&gt;101 17Nov2009&amp;nbsp;GCCULTURE&lt;/P&gt;&lt;P&gt;102 16Nov2009 &lt;SPAN&gt;GCNAAT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;102 17Nov2009 &lt;SPAN&gt;GCNAAT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;102 18Nov2009 &lt;SPAN&gt;GCCULTURE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;103 18Nov2009&lt;SPAN&gt;GCCULTURE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;104 19Nov2009 &lt;SPAN&gt;GCCULTURE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;105 17Nov2009&amp;nbsp;GCNAAT&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; ae;&lt;/P&gt;&lt;P&gt;input pid &lt;STRONG&gt;1&lt;/STRONG&gt;-&lt;STRONG&gt;3&lt;/STRONG&gt; @&lt;STRONG&gt;5&lt;/STRONG&gt; date date9. event $ &lt;STRONG&gt;15&lt;/STRONG&gt;-&lt;STRONG&gt;35&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;format date mmddyy10.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;101 16Nov2009&amp;nbsp;AZE&lt;/P&gt;&lt;P&gt;102 16Nov2009 GEN&lt;/P&gt;&lt;P&gt;102 17Nov2009&amp;nbsp;FLU&lt;/P&gt;&lt;P&gt;102 18Nov2009MEN&lt;/P&gt;&lt;P&gt;103 17Nov2009&amp;nbsp;GEN&lt;/P&gt;&lt;P&gt;103 18Nov2009 AZI&lt;/P&gt;&lt;P&gt;105 17Nov2009 MEN&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;Need your help please.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 19:28:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472262#M121068</guid>
      <dc:creator>Dhana18</dc:creator>
      <dc:date>2018-06-21T19:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472270#M121072</link>
      <description>&lt;P&gt;Expected output?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 19:41:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472270#M121072</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-21T19:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472272#M121073</link>
      <description>&lt;P&gt;would like to have table without losing data from both table.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 19:45:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472272#M121073</guid>
      <dc:creator>Dhana18</dc:creator>
      <dc:date>2018-06-21T19:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472273#M121074</link>
      <description>would like to have merged data set without losing data from both table.</description>
      <pubDate>Thu, 21 Jun 2018 19:45:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472273#M121074</guid>
      <dc:creator>Dhana18</dc:creator>
      <dc:date>2018-06-21T19:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472277#M121076</link>
      <description>&lt;P&gt;There still needs to be more clarification.&lt;/P&gt;
&lt;P&gt;Record 102 has 3 records in table 1 and 3 records in table 2.&lt;/P&gt;
&lt;P&gt;How many records do you expect as output? What &lt;U&gt;&lt;STRONG&gt;exactly&lt;/STRONG&gt;&lt;/U&gt; are you expecting as output?&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212762"&gt;@Dhana18&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;would like to have merged data set without losing data from both table.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 19:51:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472277#M121076</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-21T19:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472284#M121080</link>
      <description>&lt;P&gt;Thank you. I am trying to merge them by id and date, so if any of these (id or date) are present in any of these datasets then I want them in the merged data set.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 20:06:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472284#M121080</guid>
      <dc:creator>Dhana18</dc:creator>
      <dc:date>2018-06-21T20:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472287#M121082</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select t1.pid as cm_PID, t1.date as cm_DATE, t1.medication, 
       t2.pid as ae_PID, t2.date as ae_date, t2.event
from cm as t1
full join ae as t2
on t1.pid=t2.pid and t1.date=t2.date;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Jun 2018 20:12:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472287#M121082</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-21T20:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472291#M121083</link>
      <description>&lt;P&gt;Thank you for your quick response. This was just an example. &amp;nbsp;I have many variables like age , sex , zip etc &amp;nbsp;in the data sets I am trying to merge. &amp;nbsp;So do I need to list all of the variables in select &amp;nbsp;like you have below?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 20:26:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472291#M121083</guid>
      <dc:creator>Dhana18</dc:creator>
      <dc:date>2018-06-21T20:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472294#M121084</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212762"&gt;@Dhana18&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for your quick response. This was just an example. &amp;nbsp;I have many variables like age , sex , zip etc &amp;nbsp;in the data sets I am trying to merge. &amp;nbsp;So do I need to list all of the variables in select &amp;nbsp;like you have below?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Depends. You can use wild card references but then you'll have issues with any duplicates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select t1.*, t2.*&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This selects all columns but if you have columns with the same name it's problematic.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 20:32:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/472294#M121084</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-21T20:32:35Z</dc:date>
    </item>
  </channel>
</rss>

