<?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: Merge and Keep option in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517493#M139925</link>
    <description>Thankyou !!</description>
    <pubDate>Fri, 30 Nov 2018 14:39:03 GMT</pubDate>
    <dc:creator>Ranjeeta</dc:creator>
    <dc:date>2018-11-30T14:39:03Z</dc:date>
    <item>
      <title>Merge and Keep option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517146#M139742</link>
      <description>&lt;P&gt;data SP340_WITH_REG_TIME_PtLHIN nonmatches ;&lt;BR /&gt;merge sp340_wregtime_sorted(in=INSp340) DAD1718_sorted(in=INDAD)(KEEP=PATIENT_LHIN);&lt;BR /&gt;by CIHI_KEY;&lt;BR /&gt;if INSp340 =1 and INDAD=1 then output SP340_WITH_REG_TIME_PtLHIN;&lt;BR /&gt;ELSE output nonmatches;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;Can somone please advise how to write the keep&amp;nbsp;option correctly in the merge statement&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 16:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517146#M139742</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-11-29T16:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Merge and Keep option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517154#M139746</link>
      <description>&lt;P&gt;Do it in the same parenthesis&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data SP340_WITH_REG_TIME_PtLHIN nonmatches ;
merge sp340_wregtime_sorted(in=INSp340) DAD1718_sorted(in=INDAD KEEP=PATIENT_LHIN);
by CIHI_KEY;
if INSp340 =1 and INDAD=1 then output SP340_WITH_REG_TIME_PtLHIN;
ELSE output nonmatches;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Nov 2018 17:11:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517154#M139746</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-11-29T17:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: Merge and Keep option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517165#M139752</link>
      <description>I get the error BY variable CIHI_KEY is not on input data set WORK.DAD1718_SORTED&lt;BR /&gt;but I see the variabe when I do proc contents Please advise&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Nov 2018 17:32:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517165#M139752</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-11-29T17:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: Merge and Keep option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517168#M139755</link>
      <description>&lt;P&gt;If SAS says that a variable is not in a data set, it is not there. Period.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please post the output from the contents procedure&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 17:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517168#M139755</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-11-29T17:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Merge and Keep option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517177#M139763</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/240770"&gt;@Ranjeeta&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the KEEP= dataset option you exclude all other variables. So, you should add the BY variable to the keep list:&lt;BR /&gt; &lt;FONT face="courier new,courier"&gt;keep=patient_lhin cihi_key&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 18:06:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517177#M139763</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-11-29T18:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Merge and Keep option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517179#M139764</link>
      <description>&lt;P&gt;It was because i did not nclude the variable on keep option&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 18:11:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517179#M139764</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-11-29T18:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: Merge and Keep option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517181#M139766</link>
      <description>There were 620 observations read from the data set WORK.SP340_WREGTIME_SORTED.&lt;BR /&gt;NOTE: There were 1197772 observations read from the data set WORK.DAD1718_SORTED.&lt;BR /&gt;NOTE: The data set EVT.SP340_WITH_REG_TIME_PTLHIN has 620 observations and 17 variables.&lt;BR /&gt;NOTE: The data set WORK.NONMATCHES has 1197174 observations and 17 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 7.00 seconds&lt;BR /&gt;cpu time 3.23 seconds&lt;BR /&gt;&lt;BR /&gt;Why am I getting 22 additional records</description>
      <pubDate>Thu, 29 Nov 2018 18:13:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517181#M139766</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-11-29T18:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Merge and Keep option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517182#M139767</link>
      <description>&lt;P&gt;There were 620 observations read from the data set WORK.SP340_WREGTIME_SORTED.&lt;BR /&gt;NOTE: There were 1197772 observations read from the data set WORK.DAD1718_SORTED.&lt;BR /&gt;NOTE: The data set EVT.SP340_WITH_REG_TIME_PTLHIN has 620 observations and 17 variables.&lt;BR /&gt;NOTE: The data set WORK.NONMATCHES has 1197174 observations and 17 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 7.00 seconds&lt;BR /&gt;cpu time 3.23 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why am i getting 22 additional recors in nonmatches&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 18:13:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517182#M139767</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-11-29T18:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: Merge and Keep option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517195#M139771</link>
      <description>&lt;P&gt;The totals should only add up if both datasets only have one observation per BY group.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 19:09:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517195#M139771</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-11-29T19:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Merge and Keep option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517226#M139788</link>
      <description>thankyou</description>
      <pubDate>Thu, 29 Nov 2018 20:33:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517226#M139788</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-11-29T20:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Merge and Keep option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517233#M139794</link>
      <description>data EVTQBP EVTnotQBP;&lt;BR /&gt;merge EVT.EVT_hometime(in=INfullcohort) EVT.Evt_qbp(in=INQBP);&lt;BR /&gt;by CIHI_KEY;&lt;BR /&gt;if INfullcohort =1 and INQBP=0 then output EVTnotQBP;&lt;BR /&gt;ELSE output EVTQBP;&lt;BR /&gt;run;&lt;BR /&gt;EVT.Home time data set has 696 keys and EVT.Evt_qbp has 687 keys&lt;BR /&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;BR /&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;BR /&gt;Is my code correct to get the desired output?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Nov 2018 20:45:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517233#M139794</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-11-29T20:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Merge and Keep option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517266#M139807</link>
      <description>&lt;P&gt;There are up to three (mutually exclusive) possible cases for the pair (&lt;SPAN&gt;INfullcohort, INQBP): (1, 0), (0, 1) and (1, 1). You write the observations belonging to the first case to dataset EVTnotQBP (which makes sense), but EVTQBP will then in general contain observations with "keys that are only present in the EVT.Evt_qbp dataset" &lt;EM&gt;plus&lt;/EM&gt; observations with keys that are present in &lt;EM&gt;both&lt;/EM&gt; datasets.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Edit: Regarding your previous question:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For example, even if the 620 keys (CIHI_KEY values) in&amp;nbsp;SP340_WREGTIME_SORTED were unique, it could be that each of 22 of them match 2 observations in&amp;nbsp;DAD1718_SORTED&amp;nbsp;while 22 other keys don't match any observation. Now, if the remaining 620-22-22=576 keys lead to one-to-one matches, you'll get 576*1+22*2=620 observations in the "intersection" (SP340_WITH_REG_TIME_PTLHIN).&amp;nbsp;Finally, DAD1718_SORTED will contribute 1197772-620 observations to dataset NONMATCHES in addition to the 22 with non-matching keys from&amp;nbsp;SP340_WREGTIME_SORTED, resulting in a total of 1197772-620+22=1197174 observations in&amp;nbsp;NONMATCHES.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 21:32:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517266#M139807</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-11-29T21:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: Merge and Keep option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517278#M139813</link>
      <description>ok then how would i write the code to get only the EVT QBP cases</description>
      <pubDate>Thu, 29 Nov 2018 21:48:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517278#M139813</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-11-29T21:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Merge and Keep option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517291#M139821</link>
      <description>&lt;P&gt;Just insert the appropriate IF condition into the ELSE statement:&lt;/P&gt;
&lt;PRE&gt;else &lt;STRONG&gt;if INfullcohort=0 and INQBP=1 then&lt;/STRONG&gt; output EVTQBP;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Nov 2018 22:51:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517291#M139821</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-11-29T22:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: Merge and Keep option</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517493#M139925</link>
      <description>Thankyou !!</description>
      <pubDate>Fri, 30 Nov 2018 14:39:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-and-Keep-option/m-p/517493#M139925</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-11-30T14:39:03Z</dc:date>
    </item>
  </channel>
</rss>

