<?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/517574#M139978</link>
    <description>&lt;P&gt;You've got all the tools presented to you.&amp;nbsp; It's time to experiment on sample data.&amp;nbsp;&amp;nbsp; For this question, I suspect that will be far more valuable than an answer from even the most instructive forum response.&lt;/P&gt;</description>
    <pubDate>Fri, 30 Nov 2018 17:01:41 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2018-11-30T17:01:41Z</dc:date>
    <item>
      <title>Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/517257#M139803</link>
      <description>&lt;P&gt;&lt;SPAN&gt;data EVTQBP EVTnotQBP;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;merge EVT.EVT_hometime(in=INfullcohort) EVT.Evt_qbp(in=INQBP);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;by CIHI_KEY;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if INfullcohort =1 and INQBP=0 then output EVTnotQBP;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ELSE output EVTQBP;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;EVT.Home time data set has 696 keys and EVT.Evt_qbp has 687 keys&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to write out the 9 keys in the EVTnotQBP dataset and want to know if my code is doing it correctly?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Also in the EVTQBP dataset I want to write out the keys that are only present in the EVT.Evt_qbp dataset which has 687 observations&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;Is my code correct to get the desired output?&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 21:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/517257#M139803</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-11-29T21:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/517272#M139809</link>
      <description>&lt;P&gt;This comment assumes your have one record per key in each data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just because hometime has 696 unique key values and evt_qbp has 687 values does NOT mean there will be 9 keys in EVTnotQBP&amp;nbsp;... UNLESS&amp;nbsp; you know that evt_qbp is a proper subset of hometime (i.e. no keys in evt_qbp that are not also in evt_hometime).&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As to your code, it should work, but you don't really need the INfullcohort dummy.&amp;nbsp; You could just:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data EVTQBP EVTnotQBP;
  merge EVT.EVT_hometime EVT.Evt_qbp (in=inqbp);
  by CIHI_KEY;
  if INQBP = 0 then output EVTnotQBP;
  ELSE output EVTQBP;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Nov 2018 21:33:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/517272#M139809</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-11-29T21:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/517288#M139819</link>
      <description>&lt;P&gt;Why is it tat i dont need the infull cohort marker ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 22:36:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/517288#M139819</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-11-29T22:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/517355#M139844</link>
      <description>&lt;P&gt;It would be safer to account for every possibility:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data evt_qbp_only evt_hometime_only evt_qbp_hometime;
merge EVT.EVT_hometime(in=INfullcohort) EVT.Evt_qbp(in=INQBP);
by CIHI_KEY;
if INfullcohort =1 and INQBP=0 then output evt_hometime_only;
if INfullcohort =0 and INQBP=1 then output evt_qbp_only;
if INfullcohort =1 and INQBP=1 then output evt_qbp_hometime;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Nov 2018 04:59:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/517355#M139844</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-11-30T04:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/517360#M139847</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;If you know that evt_qbp is a proper subset of evt_hometime&lt;/STRONG&gt;&lt;/EM&gt;, then having in= dummy for evt_hometime would result in that dummy getting a value of 1 for every merged observation.&amp;nbsp; I.e. it would effectively be a constant, and offer no discriminatory power.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 05:36:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/517360#M139847</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-11-30T05:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/517553#M139968</link>
      <description>EVT QBp is a proper subset of hometime as I got 0 observations for the following if condition&lt;BR /&gt;else if inqbp = 1 and infullcohort=0 then output; Now if I need the cases that are only in QBP then saying if INfullcohort =1 and INQBP=1 then output; would be correct right?</description>
      <pubDate>Fri, 30 Nov 2018 16:29:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/517553#M139968</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-11-30T16:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/517574#M139978</link>
      <description>&lt;P&gt;You've got all the tools presented to you.&amp;nbsp; It's time to experiment on sample data.&amp;nbsp;&amp;nbsp; For this question, I suspect that will be far more valuable than an answer from even the most instructive forum response.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 17:01:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/517574#M139978</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-11-30T17:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: Merging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/517613#M139992</link>
      <description>Thanks</description>
      <pubDate>Fri, 30 Nov 2018 19:21:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging/m-p/517613#M139992</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-11-30T19:21:06Z</dc:date>
    </item>
  </channel>
</rss>

