<?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: Selecting time-frame for observations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Selecting-time-frame-for-observations/m-p/349558#M81090</link>
    <description>&lt;P&gt;That worked perfectly! &amp;nbsp;Thank you so much!!&lt;/P&gt;</description>
    <pubDate>Wed, 12 Apr 2017 18:32:04 GMT</pubDate>
    <dc:creator>cyoung</dc:creator>
    <dc:date>2017-04-12T18:32:04Z</dc:date>
    <item>
      <title>Selecting time-frame for observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-time-frame-for-observations/m-p/349553#M81088</link>
      <description>&lt;P&gt;Hello again,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if anyone can help point me in the direction of what code I should try to make what I'm hoping for work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically, I have observation in Person-Months for a span of 5 years (i.e. ID1-1... ID1-60, ID2-1... ID2-60, etc.). &amp;nbsp;I have a variable that indicates an event of interest during the month, and I was hoping to create a new dataset that has data only from 2 years after the first event. &amp;nbsp;I've tried using a IF/THEN with a KEEP statement, but am having trouble identifying the two years post event.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For reference, my dataset has 3 variables: ID, MonthYear, and Event (binary)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have an idea?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 18:06:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-time-frame-for-observations/m-p/349553#M81088</guid>
      <dc:creator>cyoung</dc:creator>
      <dc:date>2017-04-12T18:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting time-frame for observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-time-frame-for-observations/m-p/349557#M81089</link>
      <description>&lt;P&gt;If your data are already in id, monthyear order (otherwise if you sort it to be in that order), then I think that the following will do what you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  by id;
  if first.id then counter=0;
  if counter eq 0 and event eq 1 then do;
    counter=1;
    output;
  end;
  else if 1&amp;lt;=counter&amp;lt;=24 then do;
    counter+1;
    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>Wed, 12 Apr 2017 18:23:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-time-frame-for-observations/m-p/349557#M81089</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-04-12T18:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting time-frame for observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-time-frame-for-observations/m-p/349558#M81090</link>
      <description>&lt;P&gt;That worked perfectly! &amp;nbsp;Thank you so much!!&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 18:32:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-time-frame-for-observations/m-p/349558#M81090</guid>
      <dc:creator>cyoung</dc:creator>
      <dc:date>2017-04-12T18:32:04Z</dc:date>
    </item>
  </channel>
</rss>

