<?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: creating survival data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/creating-survival-data/m-p/331969#M74680</link>
    <description>&lt;P&gt;Another way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; want;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp; set&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp; by&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; id event;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp; if&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; (first.event=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt; and event=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;) or (last.id=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt; and event=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This assumes that once a record with event=1 occurs, then event stays at 1 for the remaining records of the id.&amp;nbsp; And it assumes that data are sorted by ID.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 12 Feb 2017 16:38:08 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2017-02-12T16:38:08Z</dc:date>
    <item>
      <title>creating survival data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-survival-data/m-p/331961#M74676</link>
      <description>&lt;P&gt;I have a longitudinal dataset with time variables (months) and event (0,1)...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I create a data table showing the time as when the event occurred and if the event did not occur the last follow-up time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is how the data looks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Time &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Event&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &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;1 &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;2 &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;3 &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;4 &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;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the data to look like:&lt;/P&gt;&lt;P&gt;ID &amp;nbsp; &amp;nbsp; &amp;nbsp;time &amp;nbsp; &amp;nbsp; &amp;nbsp; event&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &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;4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Feb 2017 14:50:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-survival-data/m-p/331961#M74676</guid>
      <dc:creator>Jest</dc:creator>
      <dc:date>2017-02-12T14:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: creating survival data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-survival-data/m-p/331963#M74677</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=_:);
  set have;
  retain _need;
  by id;
  if first.id then _need=1;
  if _need and (event eq 1 or last.id) then do;
    output;
    _need=0;
  end;
run;
&lt;/PRE&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Feb 2017 14:57:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-survival-data/m-p/331963#M74677</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-12T14:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: creating survival data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-survival-data/m-p/331969#M74680</link>
      <description>&lt;P&gt;Another way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; want;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp; set&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp; by&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; id event;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;&amp;nbsp; if&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; (first.event=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt; and event=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;) or (last.id=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt; and event=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This assumes that once a record with event=1 occurs, then event stays at 1 for the remaining records of the id.&amp;nbsp; And it assumes that data are sorted by ID.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Feb 2017 16:38:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-survival-data/m-p/331969#M74680</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-12T16:38:08Z</dc:date>
    </item>
  </channel>
</rss>

