<?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 carrying backward values in longitudinal data in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/carrying-backward-values-in-longitudinal-data/m-p/600481#M18320</link>
    <description>&lt;P&gt;I have the data&amp;nbsp; below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have ;&lt;BR /&gt;input id month enrol_period disenrollment reenrollment event case ;&lt;BR /&gt;cards ;&lt;BR /&gt;1 0 1 0 0 0 1&lt;BR /&gt;1 1 1 0 0 0 1&lt;BR /&gt;1 2 1 0 0 0 1&lt;BR /&gt;1 3 1 0 0 0 1&lt;BR /&gt;1 4 -1 1 0 0 1&lt;BR /&gt;1 5 -1 0 0 0 1&lt;BR /&gt;1 6 -1 0 0 0 1&lt;BR /&gt;1 7 2 0 1 0 1&lt;BR /&gt;1 8 2 0 0 0 1&lt;BR /&gt;1 9 2 0 0 0 1&lt;BR /&gt;1 10 2 0 0 1 1&lt;BR /&gt;2 0 1 0 0 0 0&lt;BR /&gt;2 1 1 0 0 0 0&lt;BR /&gt;2 2 1 0 0 0 0&lt;BR /&gt;2 3 1 0 0 0 0&lt;BR /&gt;2 4 1 0 0 0 0&lt;BR /&gt;2 5 1 0 0 0 0&lt;BR /&gt;2 6 1 0 0 0 0&lt;BR /&gt;2 7 1 0 0 0 0&lt;BR /&gt;2 8 1 0 0 0 0&lt;BR /&gt;2 9 1 0 0 0 0&lt;BR /&gt;2 10 1 0 0 0 0&amp;nbsp;&amp;nbsp;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to have the data below. The case status has been reset to 0, during the months which period is -1 and before.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Multiple disenrollment and reenrollment can happen during follow-up. Event is one of the end-points of the study. If event happens, I want to consider it only for the last period of enrollment, not entire follow-up.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want ;&lt;BR /&gt;input id month enrol_period disenrollment reenrollment event case ;&lt;BR /&gt;cards ;&lt;BR /&gt;1 0 1 0 0 0 0&lt;BR /&gt;1 1 1 0 0 0 0&lt;BR /&gt;1 2 1 0 0 0 0&lt;BR /&gt;1 3 1 0 0 0 0&lt;BR /&gt;1 4 -1 1 0 0 0&lt;BR /&gt;1 5 -1 0 0 0 0&lt;BR /&gt;1 6 -1 0 0 0 0&lt;BR /&gt;1 7 2 0 1 0 1&lt;BR /&gt;1 8 2 0 0 0 1&lt;BR /&gt;1 9 2 0 0 0 1&lt;BR /&gt;1 10 2 0 0 1 1&lt;BR /&gt;2 0 1 0 0 0 0&lt;BR /&gt;2 1 1 0 0 0 0&lt;BR /&gt;2 2 1 0 0 0 0&lt;BR /&gt;2 3 1 0 0 0 0&lt;BR /&gt;2 4 1 0 0 0 0&lt;BR /&gt;2 5 1 0 0 0 0&lt;BR /&gt;2 6 1 0 0 0 0&lt;BR /&gt;2 7 1 0 0 0 0&lt;BR /&gt;2 8 1 0 0 0 0&lt;BR /&gt;2 9 1 0 0 0 0&lt;BR /&gt;2 10 1 0 0 0 0&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas to resolve this are appreciated. Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Oct 2019 17:57:14 GMT</pubDate>
    <dc:creator>Baraso</dc:creator>
    <dc:date>2019-10-30T17:57:14Z</dc:date>
    <item>
      <title>carrying backward values in longitudinal data</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/carrying-backward-values-in-longitudinal-data/m-p/600481#M18320</link>
      <description>&lt;P&gt;I have the data&amp;nbsp; below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have ;&lt;BR /&gt;input id month enrol_period disenrollment reenrollment event case ;&lt;BR /&gt;cards ;&lt;BR /&gt;1 0 1 0 0 0 1&lt;BR /&gt;1 1 1 0 0 0 1&lt;BR /&gt;1 2 1 0 0 0 1&lt;BR /&gt;1 3 1 0 0 0 1&lt;BR /&gt;1 4 -1 1 0 0 1&lt;BR /&gt;1 5 -1 0 0 0 1&lt;BR /&gt;1 6 -1 0 0 0 1&lt;BR /&gt;1 7 2 0 1 0 1&lt;BR /&gt;1 8 2 0 0 0 1&lt;BR /&gt;1 9 2 0 0 0 1&lt;BR /&gt;1 10 2 0 0 1 1&lt;BR /&gt;2 0 1 0 0 0 0&lt;BR /&gt;2 1 1 0 0 0 0&lt;BR /&gt;2 2 1 0 0 0 0&lt;BR /&gt;2 3 1 0 0 0 0&lt;BR /&gt;2 4 1 0 0 0 0&lt;BR /&gt;2 5 1 0 0 0 0&lt;BR /&gt;2 6 1 0 0 0 0&lt;BR /&gt;2 7 1 0 0 0 0&lt;BR /&gt;2 8 1 0 0 0 0&lt;BR /&gt;2 9 1 0 0 0 0&lt;BR /&gt;2 10 1 0 0 0 0&amp;nbsp;&amp;nbsp;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to have the data below. The case status has been reset to 0, during the months which period is -1 and before.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Multiple disenrollment and reenrollment can happen during follow-up. Event is one of the end-points of the study. If event happens, I want to consider it only for the last period of enrollment, not entire follow-up.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want ;&lt;BR /&gt;input id month enrol_period disenrollment reenrollment event case ;&lt;BR /&gt;cards ;&lt;BR /&gt;1 0 1 0 0 0 0&lt;BR /&gt;1 1 1 0 0 0 0&lt;BR /&gt;1 2 1 0 0 0 0&lt;BR /&gt;1 3 1 0 0 0 0&lt;BR /&gt;1 4 -1 1 0 0 0&lt;BR /&gt;1 5 -1 0 0 0 0&lt;BR /&gt;1 6 -1 0 0 0 0&lt;BR /&gt;1 7 2 0 1 0 1&lt;BR /&gt;1 8 2 0 0 0 1&lt;BR /&gt;1 9 2 0 0 0 1&lt;BR /&gt;1 10 2 0 0 1 1&lt;BR /&gt;2 0 1 0 0 0 0&lt;BR /&gt;2 1 1 0 0 0 0&lt;BR /&gt;2 2 1 0 0 0 0&lt;BR /&gt;2 3 1 0 0 0 0&lt;BR /&gt;2 4 1 0 0 0 0&lt;BR /&gt;2 5 1 0 0 0 0&lt;BR /&gt;2 6 1 0 0 0 0&lt;BR /&gt;2 7 1 0 0 0 0&lt;BR /&gt;2 8 1 0 0 0 0&lt;BR /&gt;2 9 1 0 0 0 0&lt;BR /&gt;2 10 1 0 0 0 0&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas to resolve this are appreciated. Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 17:57:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/carrying-backward-values-in-longitudinal-data/m-p/600481#M18320</guid>
      <dc:creator>Baraso</dc:creator>
      <dc:date>2019-10-30T17:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: carrying backward values in longitudinal data</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/carrying-backward-values-in-longitudinal-data/m-p/600505#M18321</link>
      <description>&lt;P&gt;Please try the below code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
input id month enrol_period disenrollment reenrollment event case ;
if enrol_period=-1 then newvar=month;
cards ;
1 0 1 0 0 0 1
1 1 1 0 0 0 1
1 2 1 0 0 0 1
1 3 1 0 0 0 1
1 4 -1 1 0 0 1
1 5 -1 0 0 0 1
1 6 -1 0 0 0 1
1 7 2 0 1 0 1
1 8 2 0 0 0 1
1 9 2 0 0 0 1
1 10 2 0 0 1 1
2 0 1 0 0 0 0
2 1 1 0 0 0 0
2 2 1 0 0 0 0
2 3 1 0 0 0 0
2 4 1 0 0 0 0
2 5 1 0 0 0 0
2 6 1 0 0 0 0
2 7 1 0 0 0 0
2 8 1 0 0 0 0
2 9 1 0 0 0 0
2 10 1 0 0 0 0  
;
run;

proc sort data=have;
by id descending newvar;
run;

data want;
set have;
by id descending newvar;
retain newvar2;
if first.id then newvar2=newvar;
if month&amp;lt;=newvar2 then case=0;
run;

proc sort data=want;
by id month;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Oct 2019 19:16:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/carrying-backward-values-in-longitudinal-data/m-p/600505#M18321</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-10-30T19:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: carrying backward values in longitudinal data</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/carrying-backward-values-in-longitudinal-data/m-p/600516#M18322</link>
      <description>&lt;P&gt;Thank you so much Jag. This answer is exactly what I was looking for.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bahareh&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 19:43:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/carrying-backward-values-in-longitudinal-data/m-p/600516#M18322</guid>
      <dc:creator>Baraso</dc:creator>
      <dc:date>2019-10-30T19:43:16Z</dc:date>
    </item>
  </channel>
</rss>

