title: How can I group intra-day time periods into groups of 15 minutes in SAS more efficiently?
body: <p>I am trying to divide the trading hours of 9:30 am - 4:00 pm into 15 minute intervals. I want to do an analysis for each 15 minute interval separately. How can I simplify the below code as opposed to repeating that if statement for 26 intraday 15 minute intervals? </p>
  
  <p>I need to have a variable named interval as below because then I can choose to run my analysis only on certain intervals such as "if interval&lt;3".</p>
  
  <p>Thanks. </p>
  
  <pre><code>int=(minute+(hour-9)*60)-29;
  if int&lt;16 then interval=1;
  if int=&gt;16 and int&lt; 31 then interval=2;
  if int=&gt;31 and int&lt; 46 then interval=3;
  if int=&gt;46 and int&lt; 61 then interval=4;
  </code></pre>