<?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 to files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merging-to-files/m-p/524184#M142514</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/251388"&gt;@cjacobson45&lt;/a&gt;&amp;nbsp; Looks like your question has been answered. If so, plz mark the solution as accepted and close the thread&lt;/P&gt;</description>
    <pubDate>Wed, 02 Jan 2019 22:11:39 GMT</pubDate>
    <dc:creator>Andygray</dc:creator>
    <dc:date>2019-01-02T22:11:39Z</dc:date>
    <item>
      <title>Merging to files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-to-files/m-p/524100#M142486</link>
      <description>&lt;P&gt;Good Morning,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help, I know this should be simple, but this isn't working the way I need it to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two datasets one looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;File 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;MHN&amp;nbsp;&amp;nbsp; DOS&lt;/P&gt;&lt;P&gt;111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/6/16&lt;/P&gt;&lt;P&gt;111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6/10/16&lt;/P&gt;&lt;P&gt;111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/5/16&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second dataset&lt;/P&gt;&lt;P&gt;MHN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Admit&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Discharge&lt;/P&gt;&lt;P&gt;111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/1/16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7/1/16&lt;/P&gt;&lt;P&gt;111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/2/17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3/2/17&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need is File 1 returned with a flag whether that DOS falls between the second dataset. I tried to do this, but the way I have it programmed it doesn’t work, it is returning multiple records (which I get why) and it flags the one, but then looks at the second date in the second dataset and flags it as the other way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;End result of what I would need is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;File 1&lt;/P&gt;&lt;P&gt;MHN&amp;nbsp;&amp;nbsp; DOS &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Inpt&lt;/P&gt;&lt;P&gt;111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/6/16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Y&lt;/P&gt;&lt;P&gt;111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6/10/16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Y&lt;/P&gt;&lt;P&gt;111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8/5/16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; N&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 14:51:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-to-files/m-p/524100#M142486</guid>
      <dc:creator>cjacobson45</dc:creator>
      <dc:date>2019-01-02T14:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Merging to files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-to-files/m-p/524106#M142488</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data one;
input MHN   DOS :mmddyy8.;
format dos mmddyy8.;
cards;
111       5/6/16
111       6/10/16
111       8/5/16
;

data two;
input MHN       (Admit       Discharge) ( :mmddyy8.);
format Admit       Discharge mmddyy8.;
cards;
111         1/1/16       7/1/16
111         2/2/17       3/2/17
; 
proc sql;
create table want as
select  a.*,ifc(max(admit&amp;lt;=DOS&amp;lt;=Discharge)&amp;gt;0,'Y','N') as Flag
from one a left join two b
on a.mhn=b.mhn
group by a.mhn,dos
order by mhn;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/251388"&gt;@cjacobson45&lt;/a&gt;&amp;nbsp; Yes very straight forward. However, may i ask why Y and N rather than 1 and 0. I always find flag var with numbers better than letters. Well, up to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or just simpler&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select  a.*,ifc(admit&amp;lt;=DOS&amp;lt;=Discharge,'Y','N') as Flag
from one a left join two b
on a.mhn=b.mhn and (admit&amp;lt;=DOS&amp;lt;=Discharge)
order by mhn;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Jan 2019 15:26:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-to-files/m-p/524106#M142488</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-02T15:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Merging to files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-to-files/m-p/524145#M142497</link>
      <description>&lt;P&gt;Please post your code, so we can alert you to the place where you went wrong.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 18:31:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-to-files/m-p/524145#M142497</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-02T18:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: Merging to files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-to-files/m-p/524178#M142511</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;Awesome thanks!!&amp;nbsp; This worked!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 21:37:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-to-files/m-p/524178#M142511</guid>
      <dc:creator>cjacobson45</dc:creator>
      <dc:date>2019-01-02T21:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Merging to files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-to-files/m-p/524184#M142514</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/251388"&gt;@cjacobson45&lt;/a&gt;&amp;nbsp; Looks like your question has been answered. If so, plz mark the solution as accepted and close the thread&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 22:11:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-to-files/m-p/524184#M142514</guid>
      <dc:creator>Andygray</dc:creator>
      <dc:date>2019-01-02T22:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Merging to files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-to-files/m-p/524346#M142588</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/251388"&gt;@cjacobson45&lt;/a&gt; You marked my comment as the solution. lol&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please mark the appropriate solution.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 18:47:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-to-files/m-p/524346#M142588</guid>
      <dc:creator>Andygray</dc:creator>
      <dc:date>2019-01-03T18:47:40Z</dc:date>
    </item>
  </channel>
</rss>

