<?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 divide time period into non-equal intervals? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387948#M277359</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138303"&gt;@aminkarimid&lt;/a&gt;&amp;nbsp;If it's not relevant to the question at hand, it's helpful to not include them in your sample data.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Aug 2017 20:03:00 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-08-14T20:03:00Z</dc:date>
    <item>
      <title>How to divide time period into non-equal intervals?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387646#M277354</link>
      <description>&lt;P&gt;Hello everybody&lt;/P&gt;&lt;P&gt;I want to divide time variable&amp;nbsp;into intervals which are described below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="fontstyle0"&gt;First half an hour: 9:00 &amp;lt;&amp;lt; Time &amp;lt; 9:30;&lt;BR /&gt;Second half an hour: 9:30 &amp;lt;&amp;lt; Time &amp;lt; 10:00;&lt;BR /&gt;Third half an hour: 10:00 &amp;lt;&amp;lt; Time &amp;lt; 10:30;&lt;BR /&gt;Fourth half an hour: 10:30 &amp;lt;&amp;lt; Time &amp;lt; 11;&lt;BR /&gt;Fifth half an hour: 11:00 &amp;lt;&amp;lt; Time &amp;lt; 11:30;&lt;BR /&gt;Sixth half an hour: &lt;U&gt;11:30 &amp;lt;&amp;lt; Time &amp;lt;&amp;lt; 12&lt;/U&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Please pay attention to last interval. It is a closed interval.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a sample of my dataset:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WORK.SAMPLEDATA01;
  infile datalines dsd truncover;
  input TRD_STCK_CD:$15. TRD_PR:32. TRD_TUROVR:14. TRD_EVENT_DT:DATE9. TRD_EVENT_TM:TIME5.;
  format TRD_TUROVR 14. TRD_EVENT_DT DATE9. TRD_EVENT_TM TIME5.;
  label TRD_STCK_CD="TRD_STCK_CD" TRD_PR="TRD_PR" TRD_TUROVR="TRD_TUROVR" TRD_EVENT_DT="TRD_EVENT_DT";
datalines4;
IKCQ1,1,100,24MAR2008,11:19
ALBZ1,1537,10000,24MAR2008,12:28
ALBZ1,1567,10,24MAR2008,13:13
AZAB1,683,10000,24MAR2008,12:20
AZAB1,695,10,24MAR2008,13:13
BALI1,850,9260,24MAR2008,9:14
BALI1,850,2000,24MAR2008,9:15
BALI1,850,10000,24MAR2008,10:15
BALI1,850,6000,24MAR2008,11:15
BALI1,850,10000,24MAR2008,11:29
BALI1,850,10000,24MAR2008,12:00
BALI1,850,10000,24MAR2008,12:28
BALI1,865,10,24MAR2008,13:13
BANK1,1164,10729,24MAR2008,8:38
BANK1,1148,2000,24MAR2008,11:24
BANK1,1147,1575,24MAR2008,11:24
BANK1,1147,5000,24MAR2008,11:40
BANK1,1147,3425,24MAR2008,11:51
BANK1,1141,41575,24MAR2008,11:59
BANK1,1141,8425,24MAR2008,11:59
BANK1,1141,30000,24MAR2008,12:00
BANK1,1162,10,24MAR2008,13:13
BHMN1,1013,1500,24MAR2008,8:00
BHMN1,1013,1500,24MAR2008,9:00
BHMN1,1013,1500,24MAR2008,9:01
BHMN1,1013,1500,24MAR2008,9:34
BHMN1,1013,1500,24MAR2008,10:05
BHMN1,1013,1500,24MAR2008,10:59
BHMN1,1013,1000,24MAR2008,11:29
BHMN1,1013,450,24MAR2008,12:00
;;;;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;How can I do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Aug 2017 17:35:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387646#M277354</guid>
      <dc:creator>aminkarimid</dc:creator>
      <dc:date>2017-08-13T17:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide time period into non-equal intervals?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387650#M277355</link>
      <description>&lt;P&gt;Use a Format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi30/001-30.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi30/001-30.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Aug 2017 18:20:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387650#M277355</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-13T18:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide time period into non-equal intervals?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387699#M277356</link>
      <description>&lt;P&gt;Just to expand&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;'s answer:&lt;/P&gt;
&lt;P&gt;By creating a format you can assign a code/order number to each sub period and add it to your data&lt;/P&gt;
&lt;P&gt;in order to enable easier analyse:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format lib=work;
   vaue tm_code
      '09:00't - '09:30't = '1'
      '09:30't - '10:00't = '2'
     ... etc. ...
      '11:30't - '12:00't = '6'
     other                = '9'
; run;

data WORK.SAMPLEDATA01;
  infile datalines dsd truncover;
  input TRD_STCK_CD:$15. TRD_PR:32. TRD_TUROVR:14. 
          TRD_EVENT_DT:DATE9. TRD_EVENT_TM:TIME5.;
  format TRD_TUROVR 14. TRD_EVENT_DT DATE9. TRD_EVENT_TM 
         TIME5.;
  TM_CODE = input(put(TRD_EVENT_TM, tm_code.),1.);   /* &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; line added &amp;lt;&amp;lt;&amp;lt; */
  label TRD_STCK_CD="TRD_STCK_CD" TRD_PR="TRD_PR" TRD_TUROVR="TRD_TUROVR" TRD_EVENT_DT="TRD_EVENT_DT";
datalines4;&lt;BR /&gt;... your data ...&lt;BR /&gt;; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Aug 2017 07:25:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387699#M277356</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-08-14T07:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide time period into non-equal intervals?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387853#M277357</link>
      <description>&lt;P&gt;And what do you want done with values out side of the specified times?&lt;/P&gt;
&lt;P&gt;Your example data has 13:13, 12:20, 12:28. So what should be done with these?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 16:33:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387853#M277357</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-14T16:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide time period into non-equal intervals?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387945#M277358</link>
      <description>These are outliers and should be deleted from sample like using WHERE statement.</description>
      <pubDate>Mon, 14 Aug 2017 19:52:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387945#M277358</guid>
      <dc:creator>aminkarimid</dc:creator>
      <dc:date>2017-08-14T19:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide time period into non-equal intervals?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387948#M277359</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138303"&gt;@aminkarimid&lt;/a&gt;&amp;nbsp;If it's not relevant to the question at hand, it's helpful to not include them in your sample data.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 20:03:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387948#M277359</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-14T20:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide time period into non-equal intervals?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387959#M277360</link>
      <description>Yes, you are right &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;, and I am sorry about that.</description>
      <pubDate>Mon, 14 Aug 2017 20:21:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387959#M277360</guid>
      <dc:creator>aminkarimid</dc:creator>
      <dc:date>2017-08-14T20:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide time period into non-equal intervals?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387960#M277361</link>
      <description>&lt;P&gt;I think this questions been answered, so please mark it as such when you have some time. Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 20:23:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387960#M277361</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-14T20:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide time period into non-equal intervals?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387978#M277362</link>
      <description>I did not get the answer. Maybe my question is ambiguous. I want to round up time in specific time interval which I described them before. But the problem is, when I round up last interval, the 12 O'clock is considered as a 12:30. On the other word the rounding interval is a half-open interval and I want change it to closed interval for last interval.</description>
      <pubDate>Mon, 14 Aug 2017 21:04:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387978#M277362</guid>
      <dc:creator>aminkarimid</dc:creator>
      <dc:date>2017-08-14T21:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to divide time period into non-equal intervals?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387990#M277363</link>
      <description>&lt;P&gt;Proc Format allows you to control that, the inclusion/exclusion of end points within the declaration.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post your non-working code. Your question is not ambiguous, it's relatively simple and a beginner should be able to piece this together IMO using the basic paper I linked to and potentially referencing the documentation on the inclusion/exclusion if not covered explicitly in the paper.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 21:29:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-divide-time-period-into-non-equal-intervals/m-p/387990#M277363</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-14T21:29:49Z</dc:date>
    </item>
  </channel>
</rss>

