<?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 identify concurrent use of drugs in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-concurrent-use-of-drugs/m-p/561076#M157017</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/177968"&gt;@Abimal_Zippi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry, I selected it as attachment, but didn't check. This time I use a code box:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/******************************************************************************/
/* RensInterval 		                        erlu   29.1.2013      */
/*                                                                            */
/* Makroen anvendes til rensning af SAS-datasæt, hvor de enkelte records      */
/* udtrykker tidsintervaller angivet ved en startdato og en slutdato.         */
/*                                                                            */
/* Makroen læser et angivet datasæt og danner et outputdatasæt, hvor          */
/* flere poster med tidsintervaller i umiddelbar fortsættelse eller overlap-  */
/* pende er komprimeret til eet interval.                                     */
/*                                                                            */
/* Makroen checker, om datasættet indeholder flere poster, hvor alle          */
/* variabelværdier er fælles bortset fra tidsintervallet, og hvor             */
/* tidsintervallerne er fortløbende eller overlappende, således at startdato  */
/* på en følgende post er &amp;lt;= dagen efter slutdato på den foregående post.     */
/* De resulterende intervalvariable får samme format som formatet på den      */
/* variabel, der er angivet son datefirst.                                    */
/*                                                                            */
/* Kaldsargumenter:                                                           */
/*                                                                            */
/* Positionelle:                                                              */
/*      Inputdatasæt	                                                      */
/*                                                                            */
/*      Outputdatasæt                                                         */
/*                                                                            */
/* Keyword:                                                                   */
/*      Datefirst=datefirst  Anvendes kun hvis varnavn ikke er datefirst      */
/*                                                                            */
/*      Datelast=datelast    Anvendes kun hvis varnavn ikke er datelast       */
/*                                                                            */
/******************************************************************************/

%macro RensInterval(thisinds,thisoutds,datefirst=DateFirst,datelast=DateLast);

	%local dropstmt datofmt SelectList WhereList datofmtstr;

	%* Check eksistens af inputdatasæt;
	%if %sysfunc(exist(&amp;amp;thisinds)) = 0 %then %do; 
		%put ERROR: Inputdataset &amp;amp;thisinds findes ikke;
		%goto wexit;
	%end;

	%let GeneratedKey = qxzworkid;
	%let dropstmt = drop &amp;amp;GeneratedKey;
	%let ContentDs = qxw1;

	proc datasets nolist;
		delete qxw1 qxw2 qxw3;
	quit;

	%* Dan datasæt med variabelspecifikationer;
	proc contents data=&amp;amp;thisinds noprint short out=&amp;amp;ContentDs;
	run;

	%* initier datoformat;
	%let datofmt = %str();

	%* dan makrovariable ud fra proc contents;
	data _null_; set &amp;amp;ContentDs end=eof;
		length SelectList WhereList $4096 fmt $60;
		retain SelectList WhereList;
		retain DatoVarChk 0;
		if lowcase(name) NE lowcase("&amp;amp;datefirst") and lowcase(name) NE lowcase("&amp;amp;datelast") then do;
			SelectList = catx(',', SelectList, name);
			WhereList = catx(' AND ', wherelist, 'a.'||trim(name)||'=b.'||trim(name));
		end;

		%* fang format på datefirst;
		if lowcase(name) = lowcase("&amp;amp;datefirst") then do;
			if lowcase(format) = 'date' and formatl = 0 then fmt = 'DATE.';
			else if lowcase(format) = 'datetime' and formatl = 0 then fmt = 'DATETIME.';
			else do;
				fmt = trim(format)||strip(put(formatl,8.0))||'.';
				if formatd &amp;gt; 0 then fmt = trim(fmt)||strip(put(formatd,8.0)); 
			end;
			call symputx('datofmt',fmt);
		end;

		%* fang de 2 datointervalvariable i datasættet;
		if lowcase(name) = lowcase("&amp;amp;datefirst") then DatoVarChk = DatoVarChk + 1;
		else if lowcase(name) = lowcase("&amp;amp;datelast") then DatoVarChk = DatoVarChk + 1;

		if eof then do;
			call symput('SelectList',trim(SelectList));
			call symput('WhereList',trim(WhereList));
			call symputx('DatoVarChk',trim(DatoVarChk));

		end;
	run;

	%* stop ved manglende datovariable;
	%if &amp;amp;DatoVarChk ne 2 %then %do;
		%put ERROR: Manglende intervalvariable - &amp;amp;datefirst eller &amp;amp;datelast ikke fundet i datasæt: &amp;amp;thisinds;
		%goto wexit;
	%end;

	%* dan datoformatstreng til at sætte format op outputdatoer;
	%if &amp;amp;datofmt = %str(0.) %then %let datofmtstr = %str();
	%else %do;
		%let datofmtstr = format qxnewfirst qxnewlast &amp;amp;datofmt;
		%put NOTE: Format til output-intervalvariable: &amp;amp;datofmt;
	%end;

	%put NOTE: SelectList = &amp;amp;SelectList;
	%put NOTE: WhereList = &amp;amp;WhereList;

	%* dan id-nummereret distinct liste over variable (undtagen datovariable);
	proc sql; 
		create table qxw2 as 
			select 
				monotonic() as &amp;amp;GeneratedKey,
				&amp;amp;SelectList 
			from (select distinct &amp;amp;SelectList from &amp;amp;thisinds as b) as a
			order by &amp;amp;GeneratedKey;
	quit;

	%* flet id-numrene ind på hele datasættet og sorter;
	proc sql;
		create table qxw3 as 
			select 
				a.*,
				b.&amp;amp;GeneratedKey
			from &amp;amp;thisinds as a, qxw2 as b
			where &amp;amp;WhereList
			order by &amp;amp;GeneratedKey, &amp;amp;datefirst, &amp;amp;datelast;
	quit;

	%* Dan resulterende intervaller;
	data &amp;amp;thisoutds(rename=(qxnewfirst=&amp;amp;datefirst qxnewlast=&amp;amp;datelast)); 
		set qxw3; by &amp;amp;GeneratedKey;
		retain qxnewfirst qxnewlast;
		&amp;amp;datofmtstr;
		drop &amp;amp;datefirst &amp;amp;datelast;
		&amp;amp;dropstmt;

		if first.&amp;amp;GeneratedKey then do;
			qxnewfirst = &amp;amp;datefirst;
			qxnewlast = &amp;amp;datelast;
		end;
		else do;
			if &amp;amp;datefirst &amp;gt; qxnewlast + 1 then do; 
				output;
				qxnewfirst = &amp;amp;datefirst;
				qxnewlast = &amp;amp;datelast;
			end;
			else if &amp;amp;datelast &amp;gt; qxnewlast then qxnewlast = &amp;amp;datelast;
		end;
		if last.&amp;amp;GeneratedKey then output;
	run;

	%wexit:
	proc datasets nolist;
		delete qxw1 qxw2 qxw3;
	quit;
%mend;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 23 May 2019 08:34:55 GMT</pubDate>
    <dc:creator>ErikLund_Jensen</dc:creator>
    <dc:date>2019-05-23T08:34:55Z</dc:date>
    <item>
      <title>How to identify concurrent use of drugs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-concurrent-use-of-drugs/m-p/560737#M156881</link>
      <description>&lt;P&gt;Hello SAS experts out there,&lt;/P&gt;&lt;P&gt;I've tried the following program, see the link below, to identify concomitant use of medicines, I run the program for two medicines, A and B, and looking at the outcome, combinations of A-A, B-B, B-B-A,... etc exist in the final output. Anyone who can really explain to me what does this mean- A-A, B-B, B-B-C.&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Concomitant-drug-medication-use/td-p/339848" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Concomitant-drug-medication-use/td-p/339848&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot,&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 08:29:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-concurrent-use-of-drugs/m-p/560737#M156881</guid>
      <dc:creator>Abimal_Zippi</dc:creator>
      <dc:date>2019-05-22T08:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify concurrent use of drugs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-concurrent-use-of-drugs/m-p/560746#M156885</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/177968"&gt;@Abimal_Zippi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems that PGStat's program is not designed to handle more than one prescription of a &lt;U&gt;given drug&lt;/U&gt; at the &lt;U&gt;same time&lt;/U&gt; for a &lt;U&gt;given ID&lt;/U&gt;.&lt;/P&gt;
&lt;P&gt;Try running the program with the following input, where two prescriptions of drug B are overlapping:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID	DRUG $	START_DT :mmddyy.	DAYS_SUPP	END_DT :mmddyy.;
datalines;
1	A	2/17/10	30	3/19/10
1	B	4/5/10	30  5/5/10
1	B	5/1/10	30	6/1/10
1	C	5/1/10	60	7/1/10
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 May 2019 09:36:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-concurrent-use-of-drugs/m-p/560746#M156885</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-05-22T09:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify concurrent use of drugs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-concurrent-use-of-drugs/m-p/560751#M156887</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/177968"&gt;@Abimal_Zippi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not easy to modify the code to handle this situation. But I have a quick fix, if you consider overlapping prescriptions of the same drug as a different problem. The intervals can be collapsed, so a drug's duration is an interval with at least one precription of the same drug.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think this will give the results you expect:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have0;
input ID	DRUG $	START_DT :mmddyy.	DAYS_SUPP	END_DT :mmddyy.;
datalines;
1	A	2/17/10	30	3/19/10
1	B	4/5/10	30  5/5/10
1	B	5/1/10	30	6/1/10
1	C	5/1/10	60	7/1/10
;
run;

%RensInterval(have0,have,datefirst=START_DT,datelast=END_DT);

data days;
set have;

&amp;lt;etc - rest of code&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The macro is attached as a sas file. All comments are in danish, but the use of arguments should be obvious.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that it checks for identical records except dates, so in this case, prescriptions of the same drug with different durations will not be seen as the same drug.&amp;nbsp;If that's a problem, drop the duration variable from input before calling the macro and recreate it afterwards as (endDate-startDate)+1.&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;</description>
      <pubDate>Wed, 22 May 2019 10:11:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-concurrent-use-of-drugs/m-p/560751#M156887</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-05-22T10:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify concurrent use of drugs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-concurrent-use-of-drugs/m-p/560998#M156981</link>
      <description>&lt;P&gt;Dear EriK, I couldn't find the macro?&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2019 01:34:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-concurrent-use-of-drugs/m-p/560998#M156981</guid>
      <dc:creator>Abimal_Zippi</dc:creator>
      <dc:date>2019-05-23T01:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify concurrent use of drugs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-concurrent-use-of-drugs/m-p/561058#M157010</link>
      <description>&lt;P&gt;I don't have time to fully develop this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, when I have faced a similar problem in the past, I have taken advantage of SQL's Cartesian product:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID DRUG $ START_DT :date9. DAYS_SUPP END_DT :date9.;
format start_dt end_dt date9.;
datalines;
1  A  17FEB2010 30 19MAR2010
1  B  05APR2010 30 05MAY2010
1  B  01MAY2010 30 01JUN2010
1  C  01MAY2010 60 01JUL2010
;
run;

* create a surrogate key ;
data have;
   sk+1;
   set have;
run;

proc sql;
   create table crossjoin as
   select
      a.id        as a_id
     ,b.id        as b_id
     ,a.drug      as a_drug
     ,b.drug      as b_drug
     ,a.start_dt  as a_start_dt
     ,b.start_dt  as b_start_dt
     ,a.end_dt    as a_end_dt
     ,b.end_dt    as b_end_dt
     ,a.days_supp as a_days_supp
     ,b.days_supp as b_days_supp
   from
      have a
   cross join
      have b
   where
      a.sk ^= b.sk
   ;
quit;

data want;
   set crossjoin;
   where b_start_dt between a_start_dt and a_end_dt;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Carefully review the pattern in the cross join output, and pick out your date overlaps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think I'm close, but there may be duplicates where you need to augment the where clause.&amp;nbsp; Such as the same data, but with the drug order reversed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you have only the records you want, it should be easy to transform them into your desired output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note the where clause could be combined with the cross join; I've coded it this way for easier debugging of the date crossing patterns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your data is huge this could have poor performance:&amp;nbsp; 1000 source records cross joined = 1,000,000 records, but most of them would get filtered out by the where clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2019 07:09:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-concurrent-use-of-drugs/m-p/561058#M157010</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-05-23T07:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify concurrent use of drugs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-concurrent-use-of-drugs/m-p/561076#M157017</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/177968"&gt;@Abimal_Zippi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry, I selected it as attachment, but didn't check. This time I use a code box:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/******************************************************************************/
/* RensInterval 		                        erlu   29.1.2013      */
/*                                                                            */
/* Makroen anvendes til rensning af SAS-datasæt, hvor de enkelte records      */
/* udtrykker tidsintervaller angivet ved en startdato og en slutdato.         */
/*                                                                            */
/* Makroen læser et angivet datasæt og danner et outputdatasæt, hvor          */
/* flere poster med tidsintervaller i umiddelbar fortsættelse eller overlap-  */
/* pende er komprimeret til eet interval.                                     */
/*                                                                            */
/* Makroen checker, om datasættet indeholder flere poster, hvor alle          */
/* variabelværdier er fælles bortset fra tidsintervallet, og hvor             */
/* tidsintervallerne er fortløbende eller overlappende, således at startdato  */
/* på en følgende post er &amp;lt;= dagen efter slutdato på den foregående post.     */
/* De resulterende intervalvariable får samme format som formatet på den      */
/* variabel, der er angivet son datefirst.                                    */
/*                                                                            */
/* Kaldsargumenter:                                                           */
/*                                                                            */
/* Positionelle:                                                              */
/*      Inputdatasæt	                                                      */
/*                                                                            */
/*      Outputdatasæt                                                         */
/*                                                                            */
/* Keyword:                                                                   */
/*      Datefirst=datefirst  Anvendes kun hvis varnavn ikke er datefirst      */
/*                                                                            */
/*      Datelast=datelast    Anvendes kun hvis varnavn ikke er datelast       */
/*                                                                            */
/******************************************************************************/

%macro RensInterval(thisinds,thisoutds,datefirst=DateFirst,datelast=DateLast);

	%local dropstmt datofmt SelectList WhereList datofmtstr;

	%* Check eksistens af inputdatasæt;
	%if %sysfunc(exist(&amp;amp;thisinds)) = 0 %then %do; 
		%put ERROR: Inputdataset &amp;amp;thisinds findes ikke;
		%goto wexit;
	%end;

	%let GeneratedKey = qxzworkid;
	%let dropstmt = drop &amp;amp;GeneratedKey;
	%let ContentDs = qxw1;

	proc datasets nolist;
		delete qxw1 qxw2 qxw3;
	quit;

	%* Dan datasæt med variabelspecifikationer;
	proc contents data=&amp;amp;thisinds noprint short out=&amp;amp;ContentDs;
	run;

	%* initier datoformat;
	%let datofmt = %str();

	%* dan makrovariable ud fra proc contents;
	data _null_; set &amp;amp;ContentDs end=eof;
		length SelectList WhereList $4096 fmt $60;
		retain SelectList WhereList;
		retain DatoVarChk 0;
		if lowcase(name) NE lowcase("&amp;amp;datefirst") and lowcase(name) NE lowcase("&amp;amp;datelast") then do;
			SelectList = catx(',', SelectList, name);
			WhereList = catx(' AND ', wherelist, 'a.'||trim(name)||'=b.'||trim(name));
		end;

		%* fang format på datefirst;
		if lowcase(name) = lowcase("&amp;amp;datefirst") then do;
			if lowcase(format) = 'date' and formatl = 0 then fmt = 'DATE.';
			else if lowcase(format) = 'datetime' and formatl = 0 then fmt = 'DATETIME.';
			else do;
				fmt = trim(format)||strip(put(formatl,8.0))||'.';
				if formatd &amp;gt; 0 then fmt = trim(fmt)||strip(put(formatd,8.0)); 
			end;
			call symputx('datofmt',fmt);
		end;

		%* fang de 2 datointervalvariable i datasættet;
		if lowcase(name) = lowcase("&amp;amp;datefirst") then DatoVarChk = DatoVarChk + 1;
		else if lowcase(name) = lowcase("&amp;amp;datelast") then DatoVarChk = DatoVarChk + 1;

		if eof then do;
			call symput('SelectList',trim(SelectList));
			call symput('WhereList',trim(WhereList));
			call symputx('DatoVarChk',trim(DatoVarChk));

		end;
	run;

	%* stop ved manglende datovariable;
	%if &amp;amp;DatoVarChk ne 2 %then %do;
		%put ERROR: Manglende intervalvariable - &amp;amp;datefirst eller &amp;amp;datelast ikke fundet i datasæt: &amp;amp;thisinds;
		%goto wexit;
	%end;

	%* dan datoformatstreng til at sætte format op outputdatoer;
	%if &amp;amp;datofmt = %str(0.) %then %let datofmtstr = %str();
	%else %do;
		%let datofmtstr = format qxnewfirst qxnewlast &amp;amp;datofmt;
		%put NOTE: Format til output-intervalvariable: &amp;amp;datofmt;
	%end;

	%put NOTE: SelectList = &amp;amp;SelectList;
	%put NOTE: WhereList = &amp;amp;WhereList;

	%* dan id-nummereret distinct liste over variable (undtagen datovariable);
	proc sql; 
		create table qxw2 as 
			select 
				monotonic() as &amp;amp;GeneratedKey,
				&amp;amp;SelectList 
			from (select distinct &amp;amp;SelectList from &amp;amp;thisinds as b) as a
			order by &amp;amp;GeneratedKey;
	quit;

	%* flet id-numrene ind på hele datasættet og sorter;
	proc sql;
		create table qxw3 as 
			select 
				a.*,
				b.&amp;amp;GeneratedKey
			from &amp;amp;thisinds as a, qxw2 as b
			where &amp;amp;WhereList
			order by &amp;amp;GeneratedKey, &amp;amp;datefirst, &amp;amp;datelast;
	quit;

	%* Dan resulterende intervaller;
	data &amp;amp;thisoutds(rename=(qxnewfirst=&amp;amp;datefirst qxnewlast=&amp;amp;datelast)); 
		set qxw3; by &amp;amp;GeneratedKey;
		retain qxnewfirst qxnewlast;
		&amp;amp;datofmtstr;
		drop &amp;amp;datefirst &amp;amp;datelast;
		&amp;amp;dropstmt;

		if first.&amp;amp;GeneratedKey then do;
			qxnewfirst = &amp;amp;datefirst;
			qxnewlast = &amp;amp;datelast;
		end;
		else do;
			if &amp;amp;datefirst &amp;gt; qxnewlast + 1 then do; 
				output;
				qxnewfirst = &amp;amp;datefirst;
				qxnewlast = &amp;amp;datelast;
			end;
			else if &amp;amp;datelast &amp;gt; qxnewlast then qxnewlast = &amp;amp;datelast;
		end;
		if last.&amp;amp;GeneratedKey then output;
	run;

	%wexit:
	proc datasets nolist;
		delete qxw1 qxw2 qxw3;
	quit;
%mend;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 May 2019 08:34:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-concurrent-use-of-drugs/m-p/561076#M157017</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-05-23T08:34:55Z</dc:date>
    </item>
  </channel>
</rss>

