<?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: How to I retain only the first instance of a join? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-I-retain-only-the-first-instance-of-a-join/m-p/644169#M192371</link>
    <description>&lt;P&gt;One way is to use GROUP BY and HAVING, something like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FROM WORK.CLM_DATA2 A

INNER JOIN WORK.CONF_DATA_FINAL_&amp;amp;QTR. CF 
 		ON A.MBR_SYS_ID = CF.MBR_SYS_ID
	   AND (A.FST_SRVC_DT ge CF.ADMIT_DT	
	    and A.FST_SRVC_DT LE CF.DISCHG_DT)
group by A.MBR_SYS_ID
having CF.ADMIT_DT = min(CF.ADMIT_DT)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You may want to add more CF variables to the GROUP BY clause, so that you get all the different claims.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not possible to give more specific advice, when there is no example of the data (post as a data step) and no SELECT clause shown.&lt;/P&gt;</description>
    <pubDate>Thu, 30 Apr 2020 08:55:46 GMT</pubDate>
    <dc:creator>s_lassen</dc:creator>
    <dc:date>2020-04-30T08:55:46Z</dc:date>
    <item>
      <title>How to I retain only the first instance of a join?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-I-retain-only-the-first-instance-of-a-join/m-p/644165#M192367</link>
      <description>&lt;P&gt;I'm not even sure how to ask this question exactly! I have two datasets of claims data , one for Inpatient Hospital Stays with a unique identifier Event ID, Admit Date and Discharge Dates. The 2nd dataset is all the claim detail. I'm trying to group the claim detail into the Unique Identifier - simple enough with a join on a Member ID and date ranges (below). Which I originally did, however, I have discovered scenarios where Member could have back-to-back IP stays with the Discharge Date of the 1st stay equal to the Admit Date of the 2nd - stopping and starting on the same day (transferred hospitals) and a single claim that has a data of service that same day so it currently "joins" to BOTH IP stays - and I only want it to join to the first. Is there a way to even do that?&lt;BR /&gt;&lt;BR /&gt;Thank you in advance for any advice!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FROM WORK.CLM_DATA2 A

INNER JOIN WORK.CONF_DATA_FINAL_&amp;amp;QTR. CF 
 		ON A.MBR_SYS_ID = CF.MBR_SYS_ID
	   AND (A.FST_SRVC_DT ge CF.ADMIT_DT	
	    and A.FST_SRVC_DT LE CF.DISCHG_DT)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Apr 2020 08:13:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-I-retain-only-the-first-instance-of-a-join/m-p/644165#M192367</guid>
      <dc:creator>kbinan</dc:creator>
      <dc:date>2020-04-30T08:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to I retain only the first instance of a join?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-I-retain-only-the-first-instance-of-a-join/m-p/644169#M192371</link>
      <description>&lt;P&gt;One way is to use GROUP BY and HAVING, something like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FROM WORK.CLM_DATA2 A

INNER JOIN WORK.CONF_DATA_FINAL_&amp;amp;QTR. CF 
 		ON A.MBR_SYS_ID = CF.MBR_SYS_ID
	   AND (A.FST_SRVC_DT ge CF.ADMIT_DT	
	    and A.FST_SRVC_DT LE CF.DISCHG_DT)
group by A.MBR_SYS_ID
having CF.ADMIT_DT = min(CF.ADMIT_DT)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You may want to add more CF variables to the GROUP BY clause, so that you get all the different claims.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not possible to give more specific advice, when there is no example of the data (post as a data step) and no SELECT clause shown.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 08:55:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-I-retain-only-the-first-instance-of-a-join/m-p/644169#M192371</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2020-04-30T08:55:46Z</dc:date>
    </item>
  </channel>
</rss>

