<?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: Identify subjects with a skipped dose in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348289#M80632</link>
    <description>&lt;P&gt;Both your and my code appear to be doing the same thing, but your method required two passes of the data, while mine only required one pass.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, unless your dealing with big data, you probably won't care that it will take twice as long.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regardless, you could have done yours in one pass if rather than using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;if y ne 1 and y ne . then x1='unscheduled visit';&lt;/PRE&gt;
&lt;P&gt;simply using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;if y ne 1 and y ne .;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
    <pubDate>Fri, 07 Apr 2017 20:21:54 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-04-07T20:21:54Z</dc:date>
    <item>
      <title>Identify subjects with a skipped dose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348250#M80620</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Identify the subjects with &lt;/SPAN&gt;skipped dose&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;ID&lt;/U&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;U&gt;Date&lt;/U&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;U&gt;Dose&lt;/U&gt; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;001 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;01Jan2014 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;10 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;001 &amp;nbsp; &amp;nbsp; 02jan2014 &amp;nbsp; &amp;nbsp; &amp;nbsp; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;001 &amp;nbsp; &amp;nbsp; 03jan2014 &amp;nbsp; &amp;nbsp; &amp;nbsp; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;001 &amp;nbsp; &amp;nbsp; 05jan2014 &amp;nbsp; &amp;nbsp; &amp;nbsp; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;002 &amp;nbsp; &amp;nbsp; 01jan2014 &amp;nbsp; &amp;nbsp; &amp;nbsp; 20 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;002 &amp;nbsp; &amp;nbsp; 02jan2014 &amp;nbsp; &amp;nbsp; &amp;nbsp; 20 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;002 &amp;nbsp; &amp;nbsp; 03jan2014 &amp;nbsp; &amp;nbsp; &amp;nbsp; 20 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;002 &amp;nbsp; &amp;nbsp; 04jan2014 &amp;nbsp; &amp;nbsp; &amp;nbsp; 20 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;003 &amp;nbsp; &amp;nbsp; 02jan2014 &amp;nbsp; &amp;nbsp; &amp;nbsp; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;003 &amp;nbsp; &amp;nbsp; 03jan2014 &amp;nbsp; &amp;nbsp; &amp;nbsp; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;003 &amp;nbsp; &amp;nbsp; 04jan2014 &amp;nbsp; &amp;nbsp; &amp;nbsp; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;003 &amp;nbsp; &amp;nbsp; 06jan2014 &amp;nbsp; &amp;nbsp; &amp;nbsp; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;help me in solving this problem.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 18:16:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348250#M80620</guid>
      <dc:creator>molla</dc:creator>
      <dc:date>2017-04-07T18:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: Identify subjects with a skipped dose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348261#M80622</link>
      <description>&lt;P&gt;Here is one way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want (drop=counter first_date);
  set have;
  retain first_date;
  by id;
  if not (first.id and last.id);
  if first.id then do;
    counter=0;
    first_date=date;
  end;
  else counter+1;
  if last.id then do;
    if date-first_date ne counter then output;
  end;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 18:41:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348261#M80622</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-04-07T18:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Identify subjects with a skipped dose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348274#M80624</link>
      <description>&lt;P&gt;Does skipped mean they missed a day?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the first dose is January 2, does that mean that they skipped January 1?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's one possibility:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;by id;&lt;/P&gt;
&lt;P&gt;days_skipped = dif(date) * (first.id=0);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It assumes that your data is already sorted by ID, and that your DATE variable contains valid SAS dates.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 19:20:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348274#M80624</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-04-07T19:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: Identify subjects with a skipped dose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348282#M80628</link>
      <description>&lt;P&gt;Hi &amp;nbsp;I have done this in following way,correct &amp;nbsp;me if any thing is wrong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=test;
	by id;
run;

data test_;
	set test;
	by id;
	x=lag(date);
	format x date9.;

	if first.id then
		x=.;

	if not first.id then
		y=date-x;

	if y ne 1 and y ne . then
		x1='unscheduled visit';
run;

data final;
	set test_;
	where x1='unscheduled visit';
	drop x y x1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Apr 2017 19:58:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348282#M80628</guid>
      <dc:creator>molla</dc:creator>
      <dc:date>2017-04-07T19:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: Identify subjects with a skipped dose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348289#M80632</link>
      <description>&lt;P&gt;Both your and my code appear to be doing the same thing, but your method required two passes of the data, while mine only required one pass.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, unless your dealing with big data, you probably won't care that it will take twice as long.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regardless, you could have done yours in one pass if rather than using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;if y ne 1 and y ne . then x1='unscheduled visit';&lt;/PRE&gt;
&lt;P&gt;simply using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;if y ne 1 and y ne .;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 20:21:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348289#M80632</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-04-07T20:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Identify subjects with a skipped dose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348294#M80633</link>
      <description>&lt;P&gt;&amp;nbsp;what if in this case if we need to find the unscheduled visits?&lt;/P&gt;&lt;P&gt;001 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;01jan2012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;/P&gt;&lt;P&gt;001 &amp;nbsp; &amp;nbsp; 08jan2012 &amp;nbsp; &amp;nbsp; &amp;nbsp; 20&lt;/P&gt;&lt;P&gt;001 &amp;nbsp; &amp;nbsp; 20jan2012 &amp;nbsp; &amp;nbsp; &amp;nbsp; 30&lt;/P&gt;&lt;P&gt;001 &amp;nbsp; &amp;nbsp; 27jan2012 &amp;nbsp; &amp;nbsp; &amp;nbsp; 40&lt;/P&gt;&lt;P&gt;001 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;02jan2012 &amp;nbsp; &amp;nbsp; &amp;nbsp; 99&lt;/P&gt;&lt;P&gt;001 &amp;nbsp; &amp;nbsp; 03jan2012 &amp;nbsp; &amp;nbsp; &amp;nbsp; 99&lt;/P&gt;&lt;P&gt;002&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 02jan2012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;/P&gt;&lt;P&gt;002&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 05jan2012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&lt;/P&gt;&lt;P&gt;002&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 03jan2012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 99&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 20:28:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348294#M80633</guid>
      <dc:creator>molla</dc:creator>
      <dc:date>2017-04-07T20:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Identify subjects with a skipped dose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348298#M80635</link>
      <description>&lt;P&gt;cud u pls explain me what does the following statement do&lt;/P&gt;&lt;P&gt;days_skipped = dif(date) * (first.id=0);&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 20:40:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348298#M80635</guid>
      <dc:creator>molla</dc:creator>
      <dc:date>2017-04-07T20:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Identify subjects with a skipped dose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348299#M80636</link>
      <description>&lt;P&gt;I presume that you mean how do you identify the skipped dossages. Regardless, if I were you I'd&amp;nbsp;wouldn't ask it in this thread but, rather, submit the question as a new thread/question. You will likely get more responses if people have a chance to be recognized as the solution provider.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 20:44:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348299#M80636</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-04-07T20:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Identify subjects with a skipped dose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348310#M80638</link>
      <description>&lt;P&gt;dif(date) takes the difference between the value of date and the value of date on the previous record.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;first.id will equal 1 for the first id and 0 for all other records within that id, so first.id=0 will have a value of 1 for each record except the first.id record where it will have a value of 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so multiplying the two will product the number of days since the last visit for each record except the first record for each id. The first record for each ID will get a value of 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;p.s. Have you posted your new question in a new thread yet?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 21:34:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348310#M80638</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-04-07T21:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Identify subjects with a skipped dose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348315#M80642</link>
      <description>&lt;P&gt;Yes I have posted&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 21:38:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-subjects-with-a-skipped-dose/m-p/348315#M80642</guid>
      <dc:creator>molla</dc:creator>
      <dc:date>2017-04-07T21:38:45Z</dc:date>
    </item>
  </channel>
</rss>

