<?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: Recovery and Time to Recovery in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520196#M3970</link>
    <description>&lt;P&gt;Sorry about that. It's posted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID Day1 Day2 Day3 Day4 Day5 Day6;
datalines;
1	0	0	1	1	1	1
2	0	1	0	1	1	1
3	0	1	1	1	0	0
;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 10 Dec 2018 23:06:55 GMT</pubDate>
    <dc:creator>Tpham</dc:creator>
    <dc:date>2018-12-10T23:06:55Z</dc:date>
    <item>
      <title>Recovery and Time to Recovery</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520194#M3968</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am having trouble to figure out how to compute these two Variables (&lt;STRONG&gt;Want:&amp;nbsp;&lt;/STRONG&gt;Recovered and starting recovery day)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HEre is a sample Data. (ID=3 Day 1 should be N and not M). Yes/No is coded as 1/0 with a format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="image.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/25527i6527970D617604DE/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&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;&amp;nbsp;&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So basically, a subject is considered recovered&amp;nbsp; if they it's a Y from one point to the end of the study (Day 45). So in the example above, ID=1 recovered started on the 3rd day and ID=2 on the 4th).&amp;nbsp; While ID=3 didn't recover as&amp;nbsp; they didn't recover day 5 and 6. THere are different patterns, basically, where subjects can recover and unrecover.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;definition of recovery:&lt;/STRONG&gt;&amp;nbsp; Yes at one timepoint and Yes at all future time points from that first time point examined (so up to Day 45).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have been trying to think of an easy way to code this, however, the only way I can think about it check every time frame for Y (e.g. day 44-45, then day 43-45.. then 42-45 etc.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am sure there is an easier way to do this, but I can't figure it out. I am hoping someone here can help me.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The next part, &lt;STRONG&gt;What is the starting time point for recovery?&lt;/STRONG&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID Day1 Day2 Day3 Day4 Day5 Day6;
datalines;
1	0	0	1	1	1	1
2	0	1	0	1	1	1
3	0	1	1	1	0	0
;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 23:10:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520194#M3968</guid>
      <dc:creator>Tpham</dc:creator>
      <dc:date>2018-12-10T23:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: Recovery and Time to Recovery</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520195#M3969</link>
      <description>&lt;P&gt;Instead of pic, may i request you to post either in the form of a datastep or plain text to make it interesting for people like to me to easily copy/paste and test&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 23:03:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520195#M3969</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-10T23:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: Recovery and Time to Recovery</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520196#M3970</link>
      <description>&lt;P&gt;Sorry about that. It's posted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID Day1 Day2 Day3 Day4 Day5 Day6;
datalines;
1	0	0	1	1	1	1
2	0	1	0	1	1	1
3	0	1	1	1	0	0
;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Dec 2018 23:06:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520196#M3970</guid>
      <dc:creator>Tpham</dc:creator>
      <dc:date>2018-12-10T23:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Recovery and Time to Recovery</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520198#M3972</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45253"&gt;@Tpham&lt;/a&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID Day1 Day2 Day3 Day4 Day5 Day6;
datalines;
1	0	0	1	1	1	1
2	0	1	0	1	1	1
3	0	1	1	1	0	0
;

data want;
set have;
array d(*) day6-day1;
if coalesce(of d(*)) then do;
Recovered='YES';
startday=dim(d)-whichn(0,of d(*))+2;
end;
else Recovered='NO';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Going forward, Kindly post in the form of datastep/plain text always. Thank you for honoring the request&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 23:21:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520198#M3972</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-10T23:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Recovery and Time to Recovery</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520199#M3973</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID Day1 Day2 Day3 Day4 Day5 Day6;
datalines;
1	0	0	1	1	1	1
2	0	1	0	1	1	1
3	0	1	1	1	0	0
;

data want(drop=i);
   set have;
   array days{*} Day1-Day6;
   Recovered="Yes";
   if Day6=0 then do;
      Recovered="No";
      startingday=.;
   end;
   else do i=dim(days) to 1 by -1;
      if days[i]=0 then do;
         startingday=i+1;
         return;
      end;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Dec 2018 23:20:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520199#M3973</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-12-10T23:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: Recovery and Time to Recovery</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520201#M3974</link>
      <description>&lt;P&gt;Thanks for this, I am starting to breakdown to understand the functions you used and looking them up, as I am not familiar with these functions.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assuming as with other functions, it would ignore missing data. (missing data is ok as long as the pattern stands)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 23:25:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520201#M3974</guid>
      <dc:creator>Tpham</dc:creator>
      <dc:date>2018-12-10T23:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: Recovery and Time to Recovery</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520202#M3975</link>
      <description>&lt;P&gt;Missing data as in? Can you modify your sample plz&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 23:26:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520202#M3975</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-10T23:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Recovery and Time to Recovery</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520204#M3977</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID Day1 Day2 Day3 Day4 Day5 Day6;
datalines;
1	0	0	1	1	1	1
2	0	1	0	1	1	1
3	0	1	1	1	0	0
4	0	0	1	.	1	1
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Yeah it looks like it does. As ID=4 is missing Day 4 and it returned Day 3 as the start day for recover&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, can you explain or point me in the right direction on what&amp;nbsp;coalesce(of d(*)) does. I am hoping to learn from this?&amp;nbsp;From looking at your code and reading up on the documentation on this function, it looks like it return the first non-missing value.&amp;nbsp;I am wondering how does the&amp;nbsp;&lt;SPAN&gt;of d(*)&lt;/SPAN&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;indicates the 1?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 23:31:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520204#M3977</guid>
      <dc:creator>Tpham</dc:creator>
      <dc:date>2018-12-10T23:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: Recovery and Time to Recovery</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520206#M3979</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45253"&gt;@Tpham&lt;/a&gt;&amp;nbsp;It's actually simple, and I will leave some NOTES shortly once i get&amp;nbsp; home. Right now, I am on the run to catch the CTA Train to get back home. Cya soon!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 23:36:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520206#M3979</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-10T23:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: Recovery and Time to Recovery</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520227#M3990</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45253"&gt;@Tpham&lt;/a&gt;&amp;nbsp; Sorry about the delay:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the logic:&lt;/P&gt;
&lt;P&gt;1. First off, I reverse the array grouping from right most to left most.This is to make it convenient to idenitify the last non missing value, reversing it makes it easy to&amp;nbsp; identify latest non missing value.&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp;&lt;SPAN&gt;coalesce(of d(*)) results in a boolean expression true(1) if found or false(0 or missing if not found)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3. If found, I basically calculate the position by subtracting from dim i.e total number of elements in array group minus the position at which the last 0 was found, and determing the first position of 1 the follows last 0, that's in essence startingday.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;4. Thhe reversal of array is the charm of this solution and everything else is plain math.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;5. I've been exposed to many of this kind, so it's easy and I'm sure with time you'll get the speed &amp;amp; intuition.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;HTH &amp;amp; Have fun!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 02:57:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/520227#M3990</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-11T02:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: Recovery and Time to Recovery</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/521678#M4261</link>
      <description>&lt;P&gt;Thank you for explaining all this. This was a great learning opportunity!!!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 22:28:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Recovery-and-Time-to-Recovery/m-p/521678#M4261</guid>
      <dc:creator>Tpham</dc:creator>
      <dc:date>2018-12-14T22:28:58Z</dc:date>
    </item>
  </channel>
</rss>

