<?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: Washout out window for medications in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Washout-out-window-for-medications/m-p/961702#M374900</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/458102"&gt;@sasgorilla&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help but the output I am looking for is a little different. The problem I am having is I have 2 different decisions based on the first prescription. If the first prescription is within 180 days from 1st Jan 2020 then I don't want to include any subsequent prescriptions until the day difference between the&amp;nbsp; consecutive prescriptions are more than 180 days and including all the prescriptions thereafter. But if the first prescription is after 180 days from 1st Jan 2020 then I can include all the prescriptions without bothering about the day difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Abhi&lt;/P&gt;</description>
    <pubDate>Wed, 12 Mar 2025 16:41:17 GMT</pubDate>
    <dc:creator>abhi309</dc:creator>
    <dc:date>2025-03-12T16:41:17Z</dc:date>
    <item>
      <title>Washout out window for medications</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Washout-out-window-for-medications/m-p/961684#M374897</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am stuck and seeking help. I have a dataset which has prescription claims and I want to include claims after 180 days of washout period for each patient. The first claim I have is from 1st Jan 2020. So I don't want to include any claim which is within 180 days from 1st Jan 2020 and don't want to include the subsequent claims if the first claim of the patient is&amp;nbsp;within 180 days from 1st Jan 2020 and the next claim is within 180 days until the day difference between the subsequent claims are 180 days or more.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dataset I want:&lt;/P&gt;
&lt;P&gt;PT_ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PRES_DATE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Include&lt;/P&gt;
&lt;P&gt;1&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; 5Jan2020&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;0&lt;/P&gt;
&lt;P&gt;1&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; 8Feb2020&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;0&lt;/P&gt;
&lt;P&gt;1&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; 10Jan2021&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; 1&lt;/P&gt;
&lt;P&gt;1&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; 8Feb2021&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;1&lt;/P&gt;
&lt;P&gt;2&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;15Aug2020&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; 1&lt;/P&gt;
&lt;P&gt;2&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; 19Sep2020&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;1&lt;/P&gt;
&lt;P&gt;2&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;18Oct2020&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;3&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;9Jan2020&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; 0&lt;/P&gt;
&lt;P&gt;3&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;10Oct2020&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;3&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; 15Oct2020&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;4&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; 10Jul2020&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;4&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; 15Jul2020&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;4&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;20Mar2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 12 Mar 2025 14:52:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Washout-out-window-for-medications/m-p/961684#M374897</guid>
      <dc:creator>abhi309</dc:creator>
      <dc:date>2025-03-12T14:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Washout out window for medications</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Washout-out-window-for-medications/m-p/961690#M374898</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/439280"&gt;@abhi309&lt;/a&gt;&amp;nbsp;. I believe this sounds like a question I asked recently. See this post and see if the concepts work for your dataset.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Creating-new-variables-based-on-most-recent-date/m-p/959739#M374428" target="_blank"&gt;Solved: Re: Creating new variables based on most recent date - SAS Support Communities&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Mar 2025 15:34:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Washout-out-window-for-medications/m-p/961690#M374898</guid>
      <dc:creator>sasgorilla</dc:creator>
      <dc:date>2025-03-12T15:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: Washout out window for medications</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Washout-out-window-for-medications/m-p/961702#M374900</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/458102"&gt;@sasgorilla&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help but the output I am looking for is a little different. The problem I am having is I have 2 different decisions based on the first prescription. If the first prescription is within 180 days from 1st Jan 2020 then I don't want to include any subsequent prescriptions until the day difference between the&amp;nbsp; consecutive prescriptions are more than 180 days and including all the prescriptions thereafter. But if the first prescription is after 180 days from 1st Jan 2020 then I can include all the prescriptions without bothering about the day difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Abhi&lt;/P&gt;</description>
      <pubDate>Wed, 12 Mar 2025 16:41:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Washout-out-window-for-medications/m-p/961702#M374900</guid>
      <dc:creator>abhi309</dc:creator>
      <dc:date>2025-03-12T16:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Washout out window for medications</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Washout-out-window-for-medications/m-p/961709#M374901</link>
      <description>&lt;P&gt;You want to find the first observation following a date gap of 180 days or more.&amp;nbsp; All obs starting with that obs have INCLUDE=1.&amp;nbsp; All obs prior to it have INCLUDE=0.&amp;nbsp; &amp;nbsp;For the first obs of each PT_ID the gap is the number of days from 01jan2020 to PRES_DATE:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is an untested program in the absence of sample data in the form of a working DATA step.&amp;nbsp; Assuming data are sorted by PT_ID/PRES_DATE, then:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (drop=_:);
  set have;
  by pt_id;

  retain include 0;
  if first.pt_id then include=0;

  _prior_date=ifn(first.pt_id,'01jan2020'd,lag(pres_date));
  if pres_date-_prior_date&amp;gt;180 then include=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Mar 2025 18:58:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Washout-out-window-for-medications/m-p/961709#M374901</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2025-03-12T18:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Washout out window for medications</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Washout-out-window-for-medications/m-p/962342#M375089</link>
      <description>Wanted to check in if you were able to solve it. &lt;BR /&gt;</description>
      <pubDate>Thu, 20 Mar 2025 19:06:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Washout-out-window-for-medications/m-p/962342#M375089</guid>
      <dc:creator>coder1234</dc:creator>
      <dc:date>2025-03-20T19:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Washout out window for medications</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Washout-out-window-for-medications/m-p/964349#M375579</link>
      <description>&lt;P&gt;Hi abhi309,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your requirement of "i&lt;EM&gt;f the first prescription is within 180 days from 1st Jan 2020 then I don't want to include any subsequent prescriptions until the day difference between the consecutive prescriptions are more than 180 days and including all the prescriptions thereafter. But if the first prescription is after 180 days from 1st Jan 2020 then I can include all the prescriptions without bothering about the day difference&lt;/EM&gt;", it can be simplified as: "&lt;EM&gt;do not include any prescription within 180 days from 01JAN2020&lt;/EM&gt;". And thus my answer is created like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also created a data set which calculate the days between two consecutive prescriptions for one subject(or participant, or patient whatever term you use) for possible further usage. The reference code for using LAG function to calculate numeric difference of any consecutive values for one subject is from SAS Programming 3: Advanced Techniques, course notes PDF, on page 32, no.4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data preclaim;
   input PT_ID PRES_DATE date9.;
   format pres_date date9.;
   datalines;
1 5Jan2020
1 8Feb2020
1 10Jan2021
1 8Feb2021
2 15Aug2020
2 19Sep2020
2 18Oct2020
3 9Jan2020
3 10Oct2020
3 15Oct2020
4 10Jul2020
4 15Jul2020
4 20Mar2021
;
run;
proc print data=preclaim;run;
/*add include flag as 0 or 1*/
data preclaim1;
   set preclaim;
   if pres_date&amp;lt;'01jan2020'd+179
      then include=0;
   else include=1;
run;
proc print data=preclaim1;run;
/*calculate the number of days between 
any two consecutive prescription claims 
for one subject, for futher usage*/
data preclaim2;
   set preclaim;
   by pt_id;
   presdlag=lag1(pres_date);
   if first.pt_id then presdlag=.;
   diffdays=pres_date-presdlag;
   format presdlag date9.;
run;
proc print data=preclaim2;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dxiao2017_0-1744732521120.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/106249iE569584B11311FB8/image-size/large?v=v2&amp;amp;px=999" role="button" title="dxiao2017_0-1744732521120.png" alt="dxiao2017_0-1744732521120.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dxiao2017_2-1744732598199.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/106251i00D7CE46C2D5AFA5/image-size/large?v=v2&amp;amp;px=999" role="button" title="dxiao2017_2-1744732598199.png" alt="dxiao2017_2-1744732598199.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dxiao2017_3-1744732694908.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/106252i95C5FB7BEB5D8B8B/image-size/large?v=v2&amp;amp;px=999" role="button" title="dxiao2017_3-1744732694908.png" alt="dxiao2017_3-1744732694908.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Apr 2025 16:07:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Washout-out-window-for-medications/m-p/964349#M375579</guid>
      <dc:creator>dxiao2017</dc:creator>
      <dc:date>2025-04-15T16:07:06Z</dc:date>
    </item>
  </channel>
</rss>

