<?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: How to create event month? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-event-month/m-p/495944#M131020</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
   input Date:yymmdd10. rel_day;
   cards;
2006-03-01     -1842
2006-03-02     -1841
2006-03-03     -1840
2011-03-07        0
2014-04-01     1111
2014-04-02     1112
;;;;
   run;
data temp;
   set temp(where=(rel_day eq 0));
   event=date;
   do while(not eof);
      set temp end=eof;
      relchk = event - date;
      relmon = intck('MONTH',event,date);
      output;
      end;
   stop;
   format event date yymmdd10.;
   run;
proc print;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 359px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23294i8C195DA6B44A432E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 15 Sep 2018 15:17:26 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2018-09-15T15:17:26Z</dc:date>
    <item>
      <title>How to create event month?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-event-month/m-p/495915#M131007</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have following dataset:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;rel_day&lt;/P&gt;&lt;P&gt;2006-03-01&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -1842&lt;/P&gt;&lt;P&gt;2006-03-02&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -1841&lt;/P&gt;&lt;P&gt;2006-03-03&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -1840&lt;/P&gt;&lt;P&gt;.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;2011-03-07&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;2014-04-01&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1111&lt;/P&gt;&lt;P&gt;2014-04-02&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1112&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create a column event_month&amp;nbsp;where every 30 days from the event day would be a&amp;nbsp;either +month or a -month. I have used the following codes to create +month or&amp;nbsp;-month but only for a year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sample code:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; relday&amp;gt;=-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;30&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; and relday&amp;lt;=-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; event_month =-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; relday = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; event_month = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; relday&amp;gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; and relday&amp;lt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;30&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; event_month = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to create event_month for all dates in the dataset. Can someone please help?&amp;nbsp;I have got many ISIN in the dataset.&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>Sat, 15 Sep 2018 13:58:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-event-month/m-p/495915#M131007</guid>
      <dc:creator>bd_user_10</dc:creator>
      <dc:date>2018-09-15T13:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create event month?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-event-month/m-p/495944#M131020</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
   input Date:yymmdd10. rel_day;
   cards;
2006-03-01     -1842
2006-03-02     -1841
2006-03-03     -1840
2011-03-07        0
2014-04-01     1111
2014-04-02     1112
;;;;
   run;
data temp;
   set temp(where=(rel_day eq 0));
   event=date;
   do while(not eof);
      set temp end=eof;
      relchk = event - date;
      relmon = intck('MONTH',event,date);
      output;
      end;
   stop;
   format event date yymmdd10.;
   run;
proc print;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 359px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23294i8C195DA6B44A432E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Sep 2018 15:17:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-event-month/m-p/495944#M131020</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2018-09-15T15:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create event month?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-event-month/m-p/495951#M131022</link>
      <description>Hi data_null_,&lt;BR /&gt;Thanks for the code. However, there is a little issue. Your code is creating the relmon based on the end of the month from the event day. For example, if there is an event on 31st of March then from 1st April there is a new month (relmon=1). Similarly, if the event is on 1st of March then the whole month of March is relmon=0. I need to start relmon from +1 or -1 day from the event and it has to continue for next 30 days. Basically, in every thirty days from the event there will be a new month. Please let me know if you need any more clarification. Thanks again.</description>
      <pubDate>Sat, 15 Sep 2018 15:48:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-event-month/m-p/495951#M131022</guid>
      <dc:creator>bd_user_10</dc:creator>
      <dc:date>2018-09-15T15:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to create event month?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-event-month/m-p/495959#M131026</link>
      <description>&lt;P&gt;Your input sample and the required output sample is not clear. You can post a better and clearer one, and of course explaining the logic along with it&lt;/P&gt;</description>
      <pubDate>Sat, 15 Sep 2018 16:20:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-event-month/m-p/495959#M131026</guid>
      <dc:creator>MarkWik</dc:creator>
      <dc:date>2018-09-15T16:20:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to create event month?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-event-month/m-p/495974#M131038</link>
      <description>&lt;P&gt;Hi Mark, as I indicated in my post, I want to create 30 days event window from +1 and -1 event day for all rel_day. Here is the sample conditions&lt;BR /&gt;if rel_day&amp;gt;=-60 and rel_day&amp;lt;=-31 then event_month =-2;&lt;BR /&gt;if rel_day&amp;gt;=-30 and rel_day&amp;lt;=-1 then event_month =-1;&lt;BR /&gt;if rel_day = 0 then event_month = 0;&lt;BR /&gt;if rel_day&amp;gt;=1 and rel_day&amp;lt;=30 then event_month = 1;&lt;BR /&gt;if rel_day&amp;gt;=31 and rel_day&amp;lt;=60 then event_month = 2;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Sep 2018 17:47:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-event-month/m-p/495974#M131038</guid>
      <dc:creator>bd_user_10</dc:creator>
      <dc:date>2018-09-15T17:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create event month?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-event-month/m-p/495976#M131039</link>
      <description>It may help if you take the sample data from data _null_ and show the expected output from that small sample data set.</description>
      <pubDate>Sat, 15 Sep 2018 17:57:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-event-month/m-p/495976#M131039</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-15T17:57:29Z</dc:date>
    </item>
  </channel>
</rss>

