<?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 dates recurring and so repeating the same'ish code in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/dates-recurring-and-so-repeating-the-same-ish-code/m-p/8582#M397</link>
    <description>I know this must be a basic question but its really bothering me as to how to do it. I have code,&lt;BR /&gt;
&lt;BR /&gt;
proc expand data=work.gbpusd_5min out=work.gbpusd_5min_modified;&lt;BR /&gt;
where date≤'04JUN2000:22:30'dt&lt;BR /&gt;
        or&lt;BR /&gt;
	  date≥'06JUN2000:23:00'dt and date≤"11JUN2000:22:30"dt&lt;BR /&gt;
	or&lt;BR /&gt;
	  date≥'13JUN2000:23:00'dt and date≤'18JUN2000:22:30'dt&lt;BR /&gt;
	or&lt;BR /&gt;
	  date≥'20JUN2000:23:00'dt and date≤'25JUN2000:22:30'dt;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
but this is just the tip of the iceberg, that is I need to have more and more of these 'or date≥... and date≤.....' statements, like 1000's of them so I don't want to write it all out by hand but need some kind of loop/while/do syntax.&lt;BR /&gt;
&lt;BR /&gt;
The datetimes are all 7 days after the preceding one on the line before, so I'm just looking to add seven days then spit the code out again.&lt;BR /&gt;
&lt;BR /&gt;
 But I'm stumped at how to do it. I'm basically trying to take out data between Friday night at 10.30pm until Sunday night at 11pm by just including the date between these datetimes. My time series is over 20 years of data.&lt;BR /&gt;
&lt;BR /&gt;
Any help would be much appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: skipper

Message was edited by: skipper</description>
    <pubDate>Fri, 11 Feb 2011 19:46:20 GMT</pubDate>
    <dc:creator>skipper</dc:creator>
    <dc:date>2011-02-11T19:46:20Z</dc:date>
    <item>
      <title>dates recurring and so repeating the same'ish code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/dates-recurring-and-so-repeating-the-same-ish-code/m-p/8582#M397</link>
      <description>I know this must be a basic question but its really bothering me as to how to do it. I have code,&lt;BR /&gt;
&lt;BR /&gt;
proc expand data=work.gbpusd_5min out=work.gbpusd_5min_modified;&lt;BR /&gt;
where date≤'04JUN2000:22:30'dt&lt;BR /&gt;
        or&lt;BR /&gt;
	  date≥'06JUN2000:23:00'dt and date≤"11JUN2000:22:30"dt&lt;BR /&gt;
	or&lt;BR /&gt;
	  date≥'13JUN2000:23:00'dt and date≤'18JUN2000:22:30'dt&lt;BR /&gt;
	or&lt;BR /&gt;
	  date≥'20JUN2000:23:00'dt and date≤'25JUN2000:22:30'dt;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
but this is just the tip of the iceberg, that is I need to have more and more of these 'or date≥... and date≤.....' statements, like 1000's of them so I don't want to write it all out by hand but need some kind of loop/while/do syntax.&lt;BR /&gt;
&lt;BR /&gt;
The datetimes are all 7 days after the preceding one on the line before, so I'm just looking to add seven days then spit the code out again.&lt;BR /&gt;
&lt;BR /&gt;
 But I'm stumped at how to do it. I'm basically trying to take out data between Friday night at 10.30pm until Sunday night at 11pm by just including the date between these datetimes. My time series is over 20 years of data.&lt;BR /&gt;
&lt;BR /&gt;
Any help would be much appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: skipper

Message was edited by: skipper</description>
      <pubDate>Fri, 11 Feb 2011 19:46:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/dates-recurring-and-so-repeating-the-same-ish-code/m-p/8582#M397</guid>
      <dc:creator>skipper</dc:creator>
      <dc:date>2011-02-11T19:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: dates recurring and so repeating the same'ish code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/dates-recurring-and-so-repeating-the-same-ish-code/m-p/8583#M398</link>
      <description>Would this work?&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#008000;font-family:Courier New;font-size:10pt;"&gt;/*&amp;nbsp;test&amp;nbsp;data&amp;nbsp;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="color:#000080;font-family:Courier New;font-size:10pt;"&gt;data&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;one;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;datetime&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="color:#008080;font-family:Courier New;font-size:10pt;"&gt;'04jun2000:22:30'dt&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="color:#008080;font-family:Courier New;font-size:10pt;"&gt;'04jun2004:00:00'dt&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="color:#008080;font-family:Courier New;font-size:10pt;"&gt;300&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;datetime&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#008080;font-family:Courier New;font-size:10pt;"&gt;datetime.&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="color:#000080;font-family:Courier New;font-size:10pt;"&gt;run&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#008000;font-family:Courier New;font-size:10pt;"&gt;/*&amp;nbsp;remove&amp;nbsp;any&amp;nbsp;record&amp;nbsp;between&amp;nbsp;Fri&amp;nbsp;10:30pm&amp;nbsp;and&amp;nbsp;Sun&amp;nbsp;11:00pm,&amp;nbsp;exclusive&amp;nbsp;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="color:#000080;font-family:Courier New;font-size:10pt;"&gt;data&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;two;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;one;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;(weekday(datepart(datetime)));&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;when&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;(&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="color:#008080;font-family:Courier New;font-size:10pt;"&gt;6&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;)&amp;nbsp;if&amp;nbsp;timepart(datetime)&amp;nbsp;&amp;lt;&amp;nbsp;&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="color:#008080;font-family:Courier New;font-size:10pt;"&gt;'22:30't&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;then&amp;nbsp;output;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#008000;font-family:Courier New;font-size:10pt;"&gt;/*&amp;nbsp;fri&amp;nbsp;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;when&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;(&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="color:#008080;font-family:Courier New;font-size:10pt;"&gt;7&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&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;&lt;/SPAN&gt;&lt;SPAN style="color:#008000;font-family:Courier New;font-size:10pt;"&gt;/*&amp;nbsp;do&amp;nbsp;nothing&amp;nbsp;on&amp;nbsp;sat&amp;nbsp;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;when&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;(&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="color:#008080;font-family:Courier New;font-size:10pt;"&gt;1&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;)&amp;nbsp;if&amp;nbsp;&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="color:#008080;font-family:Courier New;font-size:10pt;"&gt;'23:00't&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;lt;&amp;nbsp;timepart(datetime)&amp;nbsp;then&amp;nbsp;output;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#008000;font-family:Courier New;font-size:10pt;"&gt;/*&amp;nbsp;sun&amp;nbsp;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;otherwise&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;output;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="color:#000080;font-family:Courier New;font-size:10pt;"&gt;run&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2011 22:07:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/dates-recurring-and-so-repeating-the-same-ish-code/m-p/8583#M398</guid>
      <dc:creator>chang_y_chung_hotmail_com</dc:creator>
      <dc:date>2011-02-11T22:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: dates recurring and so repeating the same'ish code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/dates-recurring-and-so-repeating-the-same-ish-code/m-p/8584#M399</link>
      <description>Or for use in a where clause&lt;BR /&gt;
&lt;BR /&gt;
Where not ((weekday(datepart(date))=6 and timepart(date) ge "23:00"t)   or &lt;BR /&gt;
       weekday(datepart(date))=7   or &lt;BR /&gt;
       (weekday(datepart(date))=1 and timepart(date) le "23:30"t));</description>
      <pubDate>Fri, 11 Feb 2011 22:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/dates-recurring-and-so-repeating-the-same-ish-code/m-p/8584#M399</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2011-02-11T22:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: dates recurring and so repeating the same'ish code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/dates-recurring-and-so-repeating-the-same-ish-code/m-p/8585#M400</link>
      <description>Thank you so much for your wisdom and excellent coding skills, it works perfectly. &lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Sat, 12 Feb 2011 17:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/dates-recurring-and-so-repeating-the-same-ish-code/m-p/8585#M400</guid>
      <dc:creator>skipper</dc:creator>
      <dc:date>2011-02-12T17:41:54Z</dc:date>
    </item>
  </channel>
</rss>

