<?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: Drug combination and switching from treatment start and end dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Drug-combination-and-switching-from-treatment-start-and-end/m-p/760323#M240423</link>
    <description>&lt;P&gt;Please post the code you have tried, along with the log so that we can help to fix the problems.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Aug 2021 07:36:54 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2021-08-09T07:36:54Z</dc:date>
    <item>
      <title>Drug combination and switching from treatment start and end dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Drug-combination-and-switching-from-treatment-start-and-end/m-p/760245#M240379</link>
      <description>&lt;P&gt;Can someone please help with the following problem?&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I have in the data:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Drug&lt;/TD&gt;&lt;TD&gt;Start DT&lt;/TD&gt;&lt;TD&gt;End DT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Drug A&lt;/TD&gt;&lt;TD&gt;3-Aug-2006&lt;/TD&gt;&lt;TD&gt;28-Dec-2006&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Drug B&lt;/TD&gt;&lt;TD&gt;3-Aug-2006&lt;/TD&gt;&lt;TD&gt;18-Nov-2007&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Drug C&lt;/TD&gt;&lt;TD&gt;29-Dec-2006&lt;/TD&gt;&lt;TD&gt;15-Dec-2008&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am trying to obtain:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Drug&lt;/TD&gt;&lt;TD&gt;Start DT New&lt;/TD&gt;&lt;TD&gt;End DT New&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Drug A + Drug B&lt;/TD&gt;&lt;TD&gt;3-Aug-2006&lt;/TD&gt;&lt;TD&gt;28-Dec-2006&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Drug B + Drug C&lt;/TD&gt;&lt;TD&gt;29-Dec-2006&lt;/TD&gt;&lt;TD&gt;18-Nov-2007&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Drug C&lt;/TD&gt;&lt;TD&gt;19-Nov-2007&lt;/TD&gt;&lt;TD&gt;15-Dec-2008&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Sun, 08 Aug 2021 15:19:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Drug-combination-and-switching-from-treatment-start-and-end/m-p/760245#M240379</guid>
      <dc:creator>goyalrk</dc:creator>
      <dc:date>2021-08-08T15:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Drug combination and switching from treatment start and end dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Drug-combination-and-switching-from-treatment-start-and-end/m-p/760264#M240385</link>
      <description>&lt;P&gt;This problem has been solved many times on this forum, e.g.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Identifying-unique-drug-regimens-in-overlapping-timelines/m-p/667816" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Identifying-unique-drug-regimens-in-overlapping-timelines/m-p/667816&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Aug 2021 18:05:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Drug-combination-and-switching-from-treatment-start-and-end/m-p/760264#M240385</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2021-08-08T18:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Drug combination and switching from treatment start and end dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Drug-combination-and-switching-from-treatment-start-and-end/m-p/760318#M240420</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank you for your response. I have tried solutions to previously posted similar problems, and for one reason or the other, they do not seem to apply for the specific data example/scenario that I have (to get the drug combinations and dates as expected). I'd very much appreciate any further assistance with this particular query.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 06:49:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Drug-combination-and-switching-from-treatment-start-and-end/m-p/760318#M240420</guid>
      <dc:creator>goyalrk</dc:creator>
      <dc:date>2021-08-09T06:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Drug combination and switching from treatment start and end dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Drug-combination-and-switching-from-treatment-start-and-end/m-p/760323#M240423</link>
      <description>&lt;P&gt;Please post the code you have tried, along with the log so that we can help to fix the problems.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 07:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Drug-combination-and-switching-from-treatment-start-and-end/m-p/760323#M240423</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-08-09T07:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Drug combination and switching from treatment start and end dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Drug-combination-and-switching-from-treatment-start-and-end/m-p/760381#M240445</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards expandtabs;
input ID	Drug $	(Start 	End) (: date11.);
format start end date11.;
cards;
1	DrugA	3-Aug-2006	28-Dec-2006
1	DrugB	3-Aug-2006	18-Nov-2007
1	DrugC	29-Dec-2006	15-Dec-2008
2	DrugA	3-Aug-2006	28-Dec-2006
2	DrugB	3-Aug-2006	18-Nov-2007
2	DrugC	29-Dec-2006	15-Dec-2008
;

data temp;
 set have;
 do date=start to end;
  output;
 end;
 format date date11.;
 drop start end;
run;
proc sort data=temp nodupkey;
by id date drug;
run;
data temp1;
do until(last.date);
 set temp;
 by id date;
 length drugs $ 200;
 drugs=catx('+',drugs,drug);
end;
drop drug;
run;
data temp2;
 set temp1;
 by id;
 if first.id or dif(date) ne 1 or drugs ne lag(drugs) then group+1;
run;
proc sql;
create table want as
select max(id) as id,max(drugs) as drug,min(date) as start format=date11.,max(date) as end format=date11.
 from temp2
  group by group;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Aug 2021 14:33:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Drug-combination-and-switching-from-treatment-start-and-end/m-p/760381#M240445</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-08-09T14:33:20Z</dc:date>
    </item>
  </channel>
</rss>

